read text file to string python 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 text file into string
with open('data.txt', 'r') as file:
data = file.read().replace('\n', '')