* Alexander Kapps <alex.ka...@web.de> [2011-07-29 22:30]: > On 29.07.2011 21:30, Carl Banks wrote: > >> It's not even fullproof on Unix. >> >> '/home//h1122/bin///ghi/'.split('/') >> >> ['','home','','bin','','','ghi',''] what about this? >>> ' '.join('/home//h1122/bin///ghi/'.split('/')).split() ['home', 'h1122', 'bin', 'ghi'] >>> ;-) regards Michael
>> Carl Banks > > This would also be fixed with normpath() as Dennis Lee Bieber suggested. > And my solution with list comprehensions handles this too. > > Still, there might be other path oddities which would break here. I > think, that something like a split_all() function should be available in > the stdlib, no? > > Actually, it isn't the first time, where I wonder why os.path.split() > doesn't do this already. I mean, str.split() doesn't only split on the > first part, right? > -- > http://mail.python.org/mailman/listinfo/python-list > -- Michael Poeltl Computational Materials Physics voice: +43-1-4277-51409 Univ. Wien, Sensengasse 8/12 fax: +43-1-4277-9514 (or 9513) A-1090 Wien, AUSTRIA cmp.mpi.univie.ac.at -- http://mail.python.org/mailman/listinfo/python-list