Python file IO operations
no vote
filePath="c:/test/tt.txt"
# Reads information from the files
F=open (filePath, "r") # using file opened for reading,
For line in f: # every time you read a file line
print(line)
f.close()
# Write information to the file
F=open (filePath, "a") # here in two ways: the first is in the form of w, it will clear previous data when writing and then write data, the second is based on a form of, write it in the form of additional data
F.write ("I began to write information to the file n")
F.writelines ("I have written to the file information")
f.close()