Adding a char inside path string
Grant Edwards
grante at visi.com
Wed Aug 16 16:55:19 EDT 2006
On 2006-08-16, Hitesh <hitesh287 at gmail.com> wrote:
> anything after .exe should be truncated (or deleted).
That will fail if any directory names contain the string
".exe", but if that's what you want, it's trivial enough:
for s in ["asdfasdf.exe -u", "soemthing/else", "asdf.exe/qwerqwer/qwerqwer.exe"]:
print `s`,
i = s.find(".exe")
print i,
if i >= 0:
s = s[:i+4]
print `s`
--
Grant Edwards grante Yow! Yow! It's some people
at inside the wall! This is
visi.com better than mopping!
More information about the Python-list
mailing list