split a directory string into a list

Michael Maibaum mike at maibaum.org
Fri Feb 25 09:39:00 EST 2005


On 25 Feb 2005, at 14:09, Harper, Gina wrote:

> I would start with something like this:
> somestring = '/foo/bar/beer/sex/cigarettes/drugs/alcohol/'
> somelist = somestring.split('/')
> print somelist

However - this will not work on Windows. It'd work on all the OS I 
usually use though ;)



Michael




More information about the Python-list mailing list