Splitting a list in python

Posted by blob8108 on Stack Overflow See other posts from Stack Overflow or by blob8108
Published on 2010-06-06T11:05:56Z Indexed on 2010/06/06 11:12 UTC
Read the original article Hit count: 243

Filed under:
|
|

Hi,

I'm writing a parser in Python. I've converted an input string into a list of tokens, such as:

['(', '2', '.', 'x', '.', '(', '3', '-', '1', ')', '+', '4', ')', '/', '3', '.', 'x', '^', '2']

I want to be able to split the list into multiple lists, like the str.split('+') function. But there doesn't seem to be a way to do my_list.split('+'). Any ideas?

Thanks!

© Stack Overflow or respective owner

Related posts about python

Related posts about lists