Answers for "how to open and read txt file python"

29

get text from txt file python

with open ("data.txt", "r") as myfile:
    data = myfile.read().splitlines()
Posted by: Guest on December-10-2020
0

how to read a file in python

# How to read, and print to the screen a file in python!

f = open('fileName', 'r')
print(f.read())
f.close()

# Where "fileName" is obviously the name of your file that you want to read.
Posted by: Guest on August-29-2021

Code answers related to "how to open and read txt file python"

Python Answers by Framework

Browse Popular Code Answers by Language