"prasad rao" <prasadarao...@gmail.com> wrote
I got a problem writing csv file.
I can't help with that specifically but...
for x in csvr:
... y=lambda x:
''.join([x.split()[3],x.split()[-3],x.split()[-6]])
... csvw.write(y)
lambdas are intended for anonymous functions so if you
are not going to pass the lambda expression directly
but assign it to a name, then it would be better to take
the definition outside the loop and only do it once.
def y(x): return ''.join([x.split()[3],x.split()[-3],x.split()[-6]])
for x in csvr:
csvw.write(y)
Traceback (most recent call last):
File "<stdin>", line 3, in <module>
AttributeError: '_csv.writer' object has no attribute 'write'
But I can't answer this bit, sorry.
Alan G
_______________________________________________
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor