path slashes cleaning

Mathieu Prevot mathieu.prevot at gmail.com
Thu Sep 4 09:25:24 EDT 2008


Hi,

for scripts that take arguments, I would like to remove the trailing
slash if it's present.

Is there something else than:

a='/usr/local/lib/'
if a[-1] == '/':
  a = list(a)
  a.pop()
  ''.join(a)

Thanks,
Mathieu



More information about the Python-list mailing list