> 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.
The split()/rsplit() functions do take an optional argument for the maximum number of splits to make, just FYI... >>> help("".split) Help on built-in function split: split(...) S.split([sep [,maxsplit]]) -> list of strings Return a list of the words in the string S, using sep as the delimiter string. If maxsplit is given, at most maxsplit splits are done. If sep is not specified or is None, any whitespace string is a separator. (as I use this on a regular basis when mashing up various text files in a data conversion process) -tkc -- http://mail.python.org/mailman/listinfo/python-list