mardi 7 février 2017

Lambda and file writing

Vote count: 0

Trying to figure out why I can't get Lambda to work with writing a file. Here is my code:

list = (i*2 for i in range(10))
file = open("text.txt", "a")
lambda i: (file.write(str(i) + "\n")), list

and I don't even get to close the file before I get following error message:

(<function <lambda> at 0x021E1B30>, <generator object <genexpr> at 0x021EC418>)

asked 27 secs ago

Let's block ads! (Why?)



Lambda and file writing

Aucun commentaire:

Enregistrer un commentaire