Newbie help with array handling

2007-04-12 Thread loial
I am new to python and am converting an awk script to python I need to store some data in an array/table of some form keyvalue1, value1, value2, value3 keyvalue2, value1,value2, value3 keyvalue3, value1,value2,value3 etc I will later need to sort in keyvalue order and also need to be able to

Re: Newbie help with array handling

2007-04-12 Thread rishi pathak
do something like this {keyvalue1:[ value1, value2, value3],keyvalue2:[value1,value2, value3],keyvalue3,:[value1,value2,value3]} On 12 Apr 2007 00:58:54 -0700, loial [EMAIL PROTECTED] wrote: I am new to python and am converting an awk script to python I need to store some data in an

Re: Newbie help with array handling

2007-04-12 Thread bruce peng
use dir with list nested for example: {key1 : [value1, value2, value3], key2 : [value1, value2, vlaue4]} loial [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I am new to python and am converting an awk script to python I need to store some data in an array/table of some form

Re: Newbie help with array handling

2007-04-12 Thread bearophileHUGS
loial: I am new to python and am converting an awk script to python It seems there are many people trying to convert awk code to Python :-) I need to store some data in an array/table of some form keyvalue1, value1, value2, value3 keyvalue2, value1,value2, value3 keyvalue3,

Re: Newbie help with array handling

2007-04-12 Thread Bruno Desthuilliers
loial a écrit : I am new to python and am converting an awk script to python I need to store some data in an array/table of some form keyvalue1, value1, value2, value3 keyvalue2, value1,value2, value3 keyvalue3, value1,value2,value3 etc data = dict( keyvalue1=[value11, value12,

Re: Newbie help with array handling

2007-04-12 Thread 7stud
loial wrote: I am new to python and am converting an awk script to python I need to store some data in an array/table of some form keyvalue1, value1, value2, value3 keyvalue2, value1,value2, value3 keyvalue3, value1,value2,value3 etc I will later need to sort in keyvalue order and also

Re: Newbie help with array handling

2007-04-12 Thread loial
OK, thanks for the replies One other thing...I need to update the values since they are basically totals that I am accumulating. How do I update a specific value for a specific key? -- http://mail.python.org/mailman/listinfo/python-list

Re: Newbie help with array handling

2007-04-12 Thread 7stud
On Apr 12, 3:31 am, loial [EMAIL PROTECTED] wrote: OK, thanks for the replies One other thing...I need to update the values since they are basically totals that I am accumulating. How do I update a specific value for a specific key? mydict[keyvalue1] returns the value, which in this case

Re: Newbie help with array handling

2007-04-12 Thread 7stud
On Apr 12, 3:50 am, 7stud [EMAIL PROTECTED] wrote: On Apr 12, 3:31 am, loial [EMAIL PROTECTED] wrote: lst = mydict[keyvalue1] lst[0] = 4 list.append(red) Rather the last line there should read: lst.append(red) -- http://mail.python.org/mailman/listinfo/python-list

Re: Newbie help with array handling

2007-04-12 Thread Shane Geiger
Since you are a beginner and since RCCILA (Runnable, Commented Code Is Least Ambiguous) I'm proving this example code to help you get used to manipulating data with python. This should give you an idea of how to juggle a bit. After you learn how to do this you likely still will not be