Re: Parsing Data, Storing into an array, Infinite Backslashes

2005-07-13 Thread [EMAIL PROTECTED]
I ended up using this code to solve my problem. for a, b, c, d in s: if not query.has_key((a,b)): query[(a,b)] = [] query[(a,b)].append(%s=%s % (c, d)) for (a,b), v in query.items(): print a, b, , .join(v) I'm relatively new to python/programming in general. I usually write in php

Re: Parsing Data, Storing into an array, Infinite Backslashes

2005-07-12 Thread [EMAIL PROTECTED]
Thanks for all the help, I'm not sure what approach I'm going to try but I think I'll try all of your suggestions and see which one fits best. The variable i held the following array: [['Memory', '0', 'Summary', '0'], ['Memory', '0', 'Speed', 'PC3200U-30330'], ['Memory', '0', 'Type', 'DDR

Parsing Data, Storing into an array, Infinite Backslashes

2005-07-11 Thread [EMAIL PROTECTED]
I am using this function to parse data I have stored in an array. This is what the array looks like: [['Memory', '0', 'Summary', '0'], ['Memory', '0', 'Speed', 'PC3200U-30330'], ['Memory', '0', 'Type', 'DDR SDRAM'], ['Memory', '0', 'Size', '512'], ['Memory', '0', 'Slot', 'DIMM0/J11'], ['Memory',

Re: Parsing Data, Storing into an array, Infinite Backslashes

2005-07-11 Thread Jeff Epler
Your code is needlessly complicated. Instead of this business while 1: try: i = fetch.next() except stopIteration: break simply write: for i in fetch: (if there's an explicit 'fetch = iter(somethingelse)' in code you did not show, then get rid of

Re: Parsing Data, Storing into an array, Infinite Backslashes

2005-07-11 Thread Steven D'Aprano
On Mon, 11 Jul 2005 13:47:22 -0700, [EMAIL PROTECTED] wrote: I am using this function to parse data I have stored in an array. This is what the array looks like: [['Memory', '0', 'Summary', '0'], ['Memory', '0', 'Speed', 'PC3200U-30330'], ['Memory', '0', 'Type', 'DDR SDRAM'], ... ] [snip