On Fri, Oct 31, 2008 at 4:04 PM, [EMAIL PROTECTED] <
[EMAIL PROTECTED]> wrote:
> Hello again,
> Thanks for the replies on my previous post, but I have a different
> problem now and don't see how to deal with it in a smooth way.
I'd probably use a dict with a list as the value:
> <snip>
> "1", "text", "aa"
> "1", "text", "xx"
> "2", "text2", "something else"
> "3", "text3", "something else"
> "3", "text3", "zz"
>
this is untested, and it's been a while since I've messed with the CSV
module, but something like this should work, if you split the first file
into 3 lists and the 2nd into two lists:
for col1, col2, col3 in zip(inCol1, inCol2, inCol3):
try:
mydict[(col1, col2)]
mydict[(col1, col2)].append(col3)
except KeyError:
mydict[(col1, col2)] = [col3]
I think that should work.
HTH,
Wayne
--
To be considered stupid and to be told so is more painful than being called
gluttonous, mendacious, violent, lascivious, lazy, cowardly: every weakness,
every vice, has found its defenders, its rhetoric, its ennoblement and
exaltation, but stupidity hasn't. - Primo Levi
_______________________________________________
Tutor maillist - [email protected]
http://mail.python.org/mailman/listinfo/tutor