En Thu, 13 Dec 2007 06:07:46 -0300, datulaida ali <[EMAIL PROTECTED]> escribi�:
> i'm trying to insert value into list according to the key (ASCII) that i > generate.. > > example : > > win = 95, so must insert into list[95] > and = 70, so must insert into list[70] > > this is my coding.. The indentation is lost so I can't see exactly what you are doing. But looks like you got a list too long (twice the size). Instead of a list, why don't use a dictionary? > list = [] Using list as a name is not a good idea, hides the builtin "list" type. I'll use "data" instead: data = {} > for i in range (100): > if i == key : > list.append([i,word]) > > else : > list.append([0]) data[key] = word > print list for key,word in sorted(data.items()): print key,word (All remaining slots are 0; you may build a true list from that) -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list