This is my code
fw = open('input.txt', 'w')
fw.write(input())
fw.close()
fr = open('input.txt', 'r')
for y in fr:
print(y)
fr.close()
When the user writes into the file. How can he go to the next line?
Whenever I hit enter it accepts only one line and does not go to the next line.
example: When I run this code, I input
1 2 3 4
The output is same as input. But I want it to be written as
1
2
3
4
in the input.txt file.
I tried the following and did not work.
fw.write(input() + "\n")
fw.write(input("\n")