Search for mapping solution

John J. Lee jjl at
Sun Jul 6 21:55:18 CEST 2003

Markus Joschko <jocsch at> writes:
> I have a List:
> nName - Number - Costs
> > lines = [['fred','333','0,10'],['sam','444','1'],['fred','333','0,50']]

Note that tuples were designed for that sort of 'mini-object' use (and
were not intended primarily as immutable lists).

lines = [('fred','333','0,10'), ('sam','444','1'), ('fred','333','0,50')]

though of course it's no disaster if you end up with a list of
3-element lists instead of 3-tuples, if it's convenient to build the
list with zip or whatever.


More information about the Python-list mailing list