String to List Question
philip at semanchuk.com
Fri Jul 3 00:15:03 CEST 2009
On Jul 2, 2009, at 6:05 PM, Hanna Michelsen wrote:
> I am brand new to python and I love it, but I've been having some
> with a file parser that I've been working on. It contains lines that
> with a name and then continue with names, nicknames and phone
> numbers of
> people associated with that name. I need to create a list of the
> names of
> people associated with each singular person (the first name in each
> Each name/phone number is separated by a tab but if someone doesn't
> have a
> nickname there are two tabs between their name and number.
> I've been trying to figure out how to test for two tabs, skip over
> people and move onto the next name but I just can't figure out how
> that will
> work in python.
> Any help would be greatly appreciated!
Are you familiar with a string's split() function? It sounds like just
what you need.
More information about the Python-list