Hi guys ,
Im new at pythons . Hope you all can help me out here :
Im trying to write a code which prints the elements from every list as a line . so If my lists are :
l1 =
l2 =
l3 =
the first two line of my output file should look like this :
0000002 a 1
0000003 b 2
I tried it in this way but it didnt work :
def listtofile():
l1 =
l2 =
l3 =
test_file = open('test3.txt', 'w')
for i in range(0,8):
s = l1+ '\t' + l2 + '\t' + l3
test_file.write(s)
test_file.readline()
test_file.close()
>>> listtofile()
Traceback (most recent call last):
File "C:\Program Files (x86)\Wing IDE 101 3.2\src\debug\tserver\_sandbox.py", line 1, in <module>
# Used internally for debug sandbox under external interpreter
File "C:\Program Files (x86)\Wing IDE 101 3.2\src\debug\tserver\_sandbox.py", line 10, in listtofile
ValueError: I/O operation on closed file
>>>