John Salerno wrote:
> If I want to have a list like this:
>
> [(first_name, 'First Name:'), (last_name, 'Last Name:').....]

Do you need the data to be ordered? If not, just use a dictionary:

d = {'First Name:': '', 'Last Name:': ''}
d['First Name:'] = 'Bob'
d['Last Name:']  = 'Smith'
print "Hi, I'm %s %s." % (d['First Name:'], d['Last Name:'])

If so, check out the ordered dictionary module [1]:

from odict import OrderedDict as odict
od = odict([('First Name:', ''), ('Last Name:', '')])
od['First Name:'] = 'James'
od['Last Name:']  = 'Bond'
for k,v in od.items():
  print "%s => %s" % (k,v)

[1] http://www.voidspace.org.uk/python/odict.html

Regards,
Jordan

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to