+ 2

How can you be able to save user input into a file in python language

20th Dec 2016, 12:21 PM
Owen Jay
Owen Jay - avatar
2 Answers
+ 1
with open(filename, "w") as f: f.write(input());
20th Dec 2016, 9:48 PM
Caffeinated Gamer YT
Caffeinated Gamer YT - avatar
0
if u want to save other inputs: file = open("filename.txt", "r") cont = file.read() file.close() file = open("newfile.txt", "w") file.write(cont + ", " + input()) file.close()
20th Dec 2016, 9:50 PM
Qoutroy Stensiö
Qoutroy Stensiö - avatar