Adding a char inside path string

Grant Edwards grante at visi.com
Wed Aug 16 16:56:15 EDT 2006


On 2006-08-16, Hitesh <hitesh287 at gmail.com> wrote:
>
> 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)

That will fail if the ".exe" isn't found.

-- 
Grant Edwards                   grante             Yow!  Does someone from
                                  at               PEORIA have a SHORTER
                               visi.com            ATTENTION span than me?



More information about the Python-list mailing list