“Obtenga texto del archivo txt python” Código de respuesta

Obtenga texto del archivo txt python

with open ("data.txt", "r") as myfile:
    data = myfile.read().splitlines()
TheProgrammer

Python lee el archivo de texto en la cadena

with open('data.txt', 'r') as file:
    data = file.read().replace('\n', '')
Blushing Bat

Cómo obtener el contenido de un archivo txt en Python

path= #path here
with open(path) as file
	contents = file.read()
ItzNightmare

Python lee el archivo de texto

# where f is the file alias
with open(r"path\to\file.txt", encoding='UTF8') as f:
    contents = f.read()
    print(contents)
Lucky-Magnet

Abra el archivo de texto en Python

f=open("Diabetes.txt",'r')
f.read()
Grieving Goshawk

Lea el archivo de texto en Python

file = '/home/text/chapter001.txt'
f=open(file,'r')
data = f.read()
print('data =',data)
bharath

Respuestas similares a “Obtenga texto del archivo txt python”

Preguntas similares a “Obtenga texto del archivo txt python”

Más respuestas relacionadas con “Obtenga texto del archivo txt python” en Python

Explore las respuestas de código populares por idioma

Explorar otros lenguajes de código