J. W. McCall wrote: > For example, given the string: > > 'spam "the life of brian" 42' > > I'd want it to return: > > ['spam', 'the life of brian', '42']
The .split() method of strings can take a substring, such as a quotation mark, as a delimiter. So a simple solution is: >>> x = 'spam "the life of brian" 42' >>> [z.strip() for z in x.split('"')] ['spam', 'the life of brian', '42'] Jeffrey -- http://mail.python.org/mailman/listinfo/python-list