Hello,
What is the way to group each value so that I get a list, from a string like:

dir = '/expert/forum/expert/expert'
list = ['/expert', '/forum', '/expert', '/expert']

I've tried:
>>> dir = '/expert/forum'
>>> dir.split('/')
['', 'expert', 'forum']
>>> dir.replace("/expert","")
'/forum'
>>> dir = '/expert/forum/expert'
>>> dir.replace("/expert","")
'/forum'

Thanks
_______________________________________________
Tutor maillist  -  [email protected]
http://mail.python.org/mailman/listinfo/tutor

Reply via email to