Nov-04-2017, 01:27 PM
Do anyone know how to add 1 to a text file.
For example :
Test.txt contain:
test 1
test 2
test 3
I wish to add 1 to the file and write to a new file NewTest.txt.
So the newtest.txt should output like it
test 2
test 3
test 4
with open('test.txt') as f:
new_file = open("newtest.txt", "w")
for item in f.readlines():
For example :
Test.txt contain:
test 1
test 2
test 3
I wish to add 1 to the file and write to a new file NewTest.txt.
So the newtest.txt should output like it
test 2
test 3
test 4
with open('test.txt') as f:
new_file = open("newtest.txt", "w")
for item in f.readlines():