python reda text file code example
Example 1: get text from txt file python
with open ("data.txt", "r") as myfile:
data = myfile.read().splitlines()
Example 2: python write file
with open("file.txt", "w") as file:
for line in ["hello", "world"]:
file.write(line)