Writing and appending in files in python
# f = open("23_writing_file.txt", "w") # write mode
# f = open ("23_writing_file.txt", "rt") # read mode
# f = open ("23_writing_file.txt", "a") # append mode
f = open ("23_writing_file.txt", "r+") # read and write mode
# f.write("SO what about next\n")
print(f.read())
f.write("love you hogai")
f.close()
Comments
Post a Comment