list comprehension to do os.path.split_all ?

Michael Torrie torriem at gmail.com
Sat Jul 30 21:44:32 EDT 2011


On Jul 29, 2011 6:33 PM, "Michael Poeltl" <michael.poeltl at univie.ac.at>
wrote:
>
> what about this?
> >>> ' '.join('/home//h1122/bin///ghi/'.split('/')).split()
> ['home', 'h1122', 'bin', 'ghi']
> >>>

Doesn't work on filenames with spaces in them.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20110730/0899767a/attachment-0001.html>


More information about the Python-list mailing list