What is the preferred way to convert a string to a string_list?
Newbie Question... casting
Collapse
X
-
What is a string_list? If you mean splitting the words up into a list of words it would be:Originally posted by freefallWhat is the preferred way to convert a string to a string_list?
[code=python]
>>> txt = 'This is an example string, which will be split'
>>> txt2 = 'This.String.Wi ll.Be.Split.At. Periods'
>>> txt.split()
['This', 'is', 'an', 'example', 'string,', 'which', 'will', 'be', 'split']
>>> txt2.split('.')
['This', 'String', 'Will', 'Be', 'Split', 'At', 'Periods']
>>> [/code]
Comment