Parsing lists

Aahz Maruch aahz at netcom.com
Sun Jul 9 11:16:43 EDT 2000


In article <UQU95.68799$HK2.1203440 at news20.bellglobal.com>,
Seamus Venasse <python at polaris.ca> wrote:
>I am creating a simple list of titles and urls.  I would like to parse this
>list, but I keep receiving an error.  Here is a simplified version of my
>code and error received:

Others have given you fixes for your code; I'd like to suggest that
perhaps a different data structure is in order:

dict = { 'url1':'title1', 'url2':'title2', 'url3':'title3' }
for (url, title) in dict.items():
  print url, title

Note that I reversed the order of url & title because usually URL makes
a better key.
--
                      --- Aahz (Copyright 2000 by aahz at netcom.com)

Androgynous poly kinky vanilla queer het    <*>     http://www.rahul.net/aahz/
Hugs and backrubs -- I break Rule 6

"do you want my self-identities alphabetically, chronologically, or in
random order?"  -- Misha



More information about the Python-list mailing list