On Wed, 27 Jul 2005, Nathan Pinno wrote:

> How do I split the list members up in the following code?

Hi Nathan,

Try using a string's split() method.  For example:

######
>>> "hello world this is a test".split()
['hello', 'world', 'this', 'is', 'a', 'test']
>>> "hello world this is a test".split('i')
['hello world th', 's ', 's a test']
######

By default, split() will break on whitespace, but we can give an optional
parameter to split on a different delimiting string.  For more details,
see:

    http://www.python.org/doc/lib/string-methods.html

_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to