0
code not writing to file
this code isn't writing to the file there's no errors and I've checked using alt+x and ran the file to test if it works but the file isn't getting updated https://code.sololearn.com/ctFYuLJ7nvN3/#py
7 odpowiedzi
0
This code is just writing newlines to the file.
It should write i.
0
Why is function write_to_file definition inside a "for" loop and an "if" statement?
The code only writes newlines (\n) to the file. Is that what you intended?
For you to add code, just write it in Code Playground, save as public, then edit your question with a link to it.
0
ive added the link
0
m.ail.a
if i use (i,'\n') i get the error
"TypeError: write() takes exactly 1 argument (2 given)"
0
jackie That's what's expected. write does take just one argument. What do you intend to write?
0
the out put of the second for loop
0
jackie Do you mean the list contents? Two hints:
You want to concatenate 'i' and a newline. Use '+' to concatenate strings.
Change your list variable name. 'list' is a data type. Overwriting is a Bad Thing.