Here is a mediocare solution. def TruncateString(s, Tindex): return string.ljust(s,Tindex){:Tindex]
s = '\\serverName\\C:\\Folder Name1\\FolderName2\\example.exe -u ABC -g XYZ' Sindex = s.find(".exe") Sindex = Tindex +4 s1 = TruncateString(s, Sindex) Hitesh wrote: > anything after .exe should be truncated (or deleted). > > > Grant Edwards wrote: > > On 2006-08-16, Hitesh <[EMAIL PROTECTED]> wrote: > > > > > That might work but what if I get (in future) a path name where > > > foldername (and in windows it is very common, someone might name a > > > folder something like "Screw You") with space? > > > > You must come up with a rigorous specification for what is and > > isn't allowed at the end of a path. > > > > Then delete the stuff that isn't allowed. > > > > -- > > Grant Edwards grante Yow! Hello? Enema > > at Bondage? I'm calling > > visi.com because I want to be > > happy, > > I guess... -- http://mail.python.org/mailman/listinfo/python-list