Python membaca file ke variabel
with open('data.txt', 'r') as file:
data = file.read().replace('\n', '')
Blushing Bat
with open('data.txt', 'r') as file:
data = file.read().replace('\n', '')
# credit to Stack Overflow user in the source link
# it has been assumed that each line is separated by a '\n' character
with open('data.txt', 'r') as file:
data = file.read().replace('\n', ' ')