Reading & Writing data from a file code example
Example 1: open text file in python
f=open("Diabetes.txt",'r')
f.read()
Example 2: python write file
with open("file.txt", "w") as file:
for line in ["hello", "world"]:
file.write(line)
f=open("Diabetes.txt",'r')
f.read()
with open("file.txt", "w") as file:
for line in ["hello", "world"]:
file.write(line)