NEW TO THIS: Assigning values to strings in list?
Chris Liechti
cliechti at gmx.net
Fri Jul 19 12:21:00 EDT 2002
Johannes Graumann <graumann at clyde.caltech.edu> wrote in
news:ah9cvk$st at gap.cco.caltech.edu:
> Basicely I have two lists, one containing the future string-names
> and one containing the values I want to give them. The order is
> identical in both. Right now I'm solving this by a dictionary, but
> I would really prefer to have straight strings as a result of my
> operation.
i think i don't understand what you exactly want... maybe you could
illustrate you problem with an example of data and how the result should
look like or a few lines from the interactive prompt, like:
>>> names = ["one", "two", "tree"]
>>> values = [1,2,3]
>>> dict(zip(names,values))
{'tree': 3, 'two': 2, 'one': 1}
chris
--
Chris <cliechti at gmx.net>
More information about the Python-list
mailing list