[Tutor] Assigning each line of text to a separate variable
Marv Boyes
marvboyes at gmail.com
Thu Jul 30 21:19:55 CEST 2009
Hello, all. This is probably embarrassingly basic, but I haven't been
able to find something that works.
I'm working on a script that needs to manipulate a list (not 'list' in
the Python sense) of URLs returned in a server response. Right now, I'm
stripping the XML tags from that response and assigning the resulting
list of URLs to a variable so I can print it in the terminal. So when I
do, say, 'print urls' I get something like this:
http://server.com/thing1
http://server.com/thing2
http://server.com/thing3
And so on. What I would _like_ to do is assign each line of that list to
a separate variable, so that I can format my output to be more explicit;
something like this:
Link to Thing1: http://server.com/thing1
Link to Thing2: http://server.com/thing2
And so on. I know this should be extremely easy, but I appear to be
having some manner of mental block. Any and all guidance would be
greatly appreciated; many thanks in advance.
More information about the Tutor
mailing list