Opening a File
file = open(file_name, mode)
Mode:
"r": open for reading (default)
"w": open for writing
"a": open for appending
"+": create new file
#alternate example
with open("abc.txt", "r") as file:
Reading a File
text = file.read #example of reading the whole file
for line in file:
print(line.strip()) #example of printing each line
Writing a File
file.write('example') #do not go to a new line
file.write('example\n') #go to a new line
Closing a File
file.close()