WRIT IN A TEXT FILE PYTHION code example
Example 1: python write file
with open("file.txt", "w") as file:
for line in ["hello", "world"]:
file.write(line)
Example 2: open text file in python
f=open("Diabetes.txt",'r')
f.read()
Example 3: python output to text file
$ python my_program.py > output.txt