python open text file as string code example
Example 1: get text from txt file python
with open ("data.txt", "r") as myfile:
data = myfile.read().splitlines()
Example 2: python read file to variable
with open('data.txt', 'r') as file:
data = file.read().replace('\n', '')