[EMAIL PROTECTED] wrote: > I'm confused. > What's the difference between this and string.split?
>>> s = 'hello, world' >>> s.split(',') ['hello', ' world'] >>> s.partition(',') ('hello', ',', ' world') split returns a list of the substrings on either side of the specified argument. partition returns a tuple of the substring on the left of the argument, the argument itself, and the substring on the right. rpartition reads from right to left. But you raise a good point. Notice this: >>> s = 'hello, world, how are you' >>> s.split(',') ['hello', ' world', ' how are you'] >>> s.partition(',') ('hello', ',', ' world, how are you') split will return all substrings. partition (and rpartition) only return the substrings before and after the first occurrence of the argument. -- http://mail.python.org/mailman/listinfo/python-list