Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #48616
| Date | 2013-06-18 12:14 +0200 |
|---|---|
| From | Andreas Perstinger <andipersti@gmail.com> |
| Subject | Re: Help me with the script? How to find items in csv file A and not in file B and vice versa |
| References | <8390d9db-a670-4f39-81cb-34c14b59d29b@googlegroups.com> <mailman.3515.1371544747.3114.python-list@python.org> <10d49cd4-90a9-4a9f-822e-207c87dafa50@googlegroups.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.3522.1371550472.3114.python-list@python.org> (permalink) |
alonnirs@gmail.com wrote:
>and when I run it I get an invalid syntex error and (as a true newbie
>I used a GUI)in_a_not_b is highlighted in the with open("inAnotB.csv",
>"wb") as f:
> writer = csv.writer(f)
> writer.writerows([item] for item in_a_not_b)
^^^^^^^^^^^^^^^^^^^^
The syntax for the for-clause in a comprehension is
for x in something
thus you are missing the "in" keyword:
writer.writerows([item] for item in in_a_not_b)
Bye, Andreas
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Help me with the script? How to find items in csv file A and not in file B and vice versa Alan Newbie <alonnirs@gmail.com> - 2013-06-18 01:01 -0700
Re: Help me with the script? How to find items in csv file A and not in file B and vice versa Peter Otten <__peter__@web.de> - 2013-06-18 10:39 +0200
Re: Help me with the script? How to find items in csv file A and not in file B and vice versa alonnirs@gmail.com - 2013-06-18 02:01 -0700
Re: Help me with the script? How to find items in csv file A and not in file B and vice versa Andreas Perstinger <andipersti@gmail.com> - 2013-06-18 12:14 +0200
Re: Help me with the script? How to find items in csv file A and not in file B and vice versa Alan Newbie <alonnirs@gmail.com> - 2013-06-18 03:48 -0700
csiph-web