I have created a series of lists in the following format:
acc1 = [value1, value2,...]
acc2 = [value1, value2,...]
acc3 = [value1, value2,...]
these lists are then added to a dictionary with 'value1' as their key:
accounts = {acc1[0]:acc1, acc2[0]:acc2, acc3[0]:acc3,....}
the problem I have is I need the program to be able add new details, ie create a new list called acc4 (5,6 depending on how meny lists there are) and add this new list to the dictionary (in the same format is above)
does anyone have any ideas of the best way to do this?
2007-04-11
23:04:23
·
2 answers
·
asked by
uktshaw
3
in
Computers & Internet
➔ Programming & Design
The new list name has to be variable not just a simple as acc4 = [ ]
it needs to be generated using something like:
newAccount = "acc" + str(len(accounts)+1)
2007-04-12
00:08:33 ·
update #1