On Jun 18, 10:49 am, Jon Clements jon...@googlemail.com wrote:
Why are you doing this? I'm assuming a code to title look up is
required (don't forget military, royal and honorable titles
etc... :) )
I'm in New Zealand. Hardly any need for military titles, rarely any
for royal and damn sure
Hello,
I am trying to generate this list of tuples:
[(0, ''), (1, 'Dr'), (2, 'Miss'), (3, 'Mr'), (4, 'Mrs'), (5, 'Ms')]
My code works fine in the Python shell:
titles = ['Dr', 'Miss', 'Mr', 'Mrs', 'Ms',]
title_choices = [(0, '')] + list((titles.index(t)+1, t) for t in titles)
title_choices
Wow! Didn't expect that kind of instant support. Thank you very much,
I'll give both zip and enumerate a try.
The code I've shown is actually copied pretty straight from a Django
form class, but I didn't want to mention that as not to dilute the
conversation. Don't think it matters, anyway. This