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 writ
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 SDRAM
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'], ... ]
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 tha
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',