archivo de lectura de Python
with open("file.txt", "r") as txt_file:
return txt_file.readlines()
Supermavster
with open("file.txt", "r") as txt_file:
return txt_file.readlines()
f=open("Diabetes.txt",'r')
f.read()
txt = open('FILENAME.txt')
txtread = txt.read()
print(txtread)
print(txt.read())
with open('pagehead.section.htm','r') as f:
output = f.read()
fin = open("NAME.txt", 'r')
body = fin.read().split("\n")
line = fin.readline().strip()
>>> f = open("test.txt",'r',encoding = 'utf-8')
>>> f.read(4) # read the first 4 data
'This'
>>> f.read(4) # read the next 4 data
' is '
>>> f.read() # read in the rest till end of file
'my first file\nThis file\ncontains three lines\n'
>>> f.read() # further reading returns empty sting
''