ntv1534 at gmail.com
Wed Nov 9 17:10:24 CET 2005
If you know the indices of where the data should be in your string, you
can use substrings... ie:
>>> stringy = " Happy Happy Cow, 50, 1234 Your Mom's House AllTheTime,USA "
' Happy Happy Cow'
If the data isn't set all the time (for example, and address doesn't
have a mandatory length), then you're probably stuck using the index
function...unless you have everything separated by a delimiter, such as
a ","...then this would work:
>>> listy = stringy.split(",")
>>> print listy
[' Happy Happy Cow', ' 50', " 1234 Your Mom's House AllTheTime", 'USA
Hope this helps!
More information about the Python-list