Alan Gauld <alan.gauld <at> btinternet.com> writes: > > On 02/12/13 11:03, Wolfgang Maier wrote: > > > ... and since you want to be able to resolve ambiguous last names based on > > first names, you will have to store not just the states, but also the first > > names. > > You can do so by turning the entries in senateInfo from a list of strings > > (states) into a list of tuples (first name, state) like this: > > > > senateInfo[lastName] = [(firstName, state)] > > > > or for pre-existing entries: > > > > senateInfo[lastName].append((firstName, state)) > > This results in a mixed set of values for your dictionary. Some will be > simple strings (or tuples), others lists of tuples. You might want to > consider standardising on a list for all even if some only have a single > value. >
Hi Alan, maybe you misread my code snippet?? It generates lists all the time just as you are suggesting (same as for Oscar's). Best, Wolfgang _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor