Hitesh, You might want to try this: >>> tricky_path_name = '\\serverName\\C:\\exe files\\example.exe -u ABC -g DEF'
>>> import SE >>> Editor = SE.SE ('C:=C$: "exe -=exe<clip here>"') >>> edited_path_name = Editor (tricky_path_name) >>> print edited_path_name # See what it did \serverName\C$:\exe files\example.exe<clip here>u ABC -g DEF >>> path_name = edited_path_name.split ('<clip here>')[0] >>> print path_name \serverName\C$:\exe files\example.exe # There you go Note 1: As long as 'print edited_path_name' doesn't look right, change the substitution definitions that make your Editor. Maybe there should be no colon after the '$'. So change ''C:=C$:' to ''C:=C$'. Should your Editor ever fail to handle a path name having an unexpected format, add another substitution definition to also accommodate the new format. Note 2: '<clip here>' is a self-documenting split mark. You'd pick a more convenient one. Note 3: If the path name ends with 'exe' it works all the same. The edited path name will not have '<clip here>'. So the split will be a list containing one element instead of two. In either case the edited path name is at index 0. Note 4: Get SE at: http://cheeseshop.python.org/pypi/SE/2.2%20beta Regards Frederic ----- Original Message ----- From: "Hitesh" <[EMAIL PROTECTED]> Newsgroups: comp.lang.python To: <python-list@python.org> Sent: Wednesday, August 16, 2006 4:15 PM Subject: Adding a char inside path string > Hi, > > I get path strings from a DB like: > > \\serverName\C:\FolderName1\FolderName2\example.exe > > I am writing a script that can give me access to that exe file. > But problem is that string is not universal path, I need to add C$. > Any idea how I can add $ char in that string. > ServerName is not fixed length. It could be any chars length. > > Thank you, > hj > > -- > http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list