Obtenez du texte à partir du fichier txt python
with open ("data.txt", "r") as myfile:
data = myfile.read().splitlines()
TheProgrammer
with open ("data.txt", "r") as myfile:
data = myfile.read().splitlines()
with open('data.txt', 'r') as file:
data = file.read().replace('\n', '')
path= #path here
with open(path) as file
contents = file.read()
# where f is the file alias
with open(r"path\to\file.txt", encoding='UTF8') as f:
contents = f.read()
print(contents)
f=open("Diabetes.txt",'r')
f.read()
file = '/home/text/chapter001.txt'
f=open(file,'r')
data = f.read()
print('data =',data)