file modes in python 3 code example
Example 1: python write to file
with open(filename,"w") as f:
f.write('Hello World')
Example 2: python file reading
fin = open("NAME.txt", 'r')
body = fin.read().split("\n")
line = fin.readline().strip()
with open(filename,"w") as f:
f.write('Hello World')
fin = open("NAME.txt", 'r')
body = fin.read().split("\n")
line = fin.readline().strip()