[Tutor] (no subject)
Kirby Urner
urnerk@qwest.net
Sun, 09 Dec 2001 22:40:23 -0800
At 06:35 PM 12/9/2001 -0500, Kirk Bailey wrote:
>ok, in IDLE I created a variable, listnamemembers, and
>inserted a bunch of info in it, with triple quotes.
>listnamemembers = """me@here.net
>you@there.org
>Me@here2.com
>everybody@earth.edu
>nobody@domainerror.cc
>"""
Instead of making your data be one long character string,
you might use a list with string elements:
>>> listmembers = ['me@here.net',
'you@there.org',
'Me@here2.com',
'everybody@earth.edu',
'nobody@domainerror.cc']
>>>
>>> for i in listmembers: print i
me@here.net
you@there.org
Me@here2.com
everybody@earth.edu
nobody@domainerror.cc
When you iterate over a list, you get its elements,
whereas when you iterate over a string, you get each
character, which is what was happening when you went
the triple-quotes route.
Kirby