Answers for "read file python readline"

2

readline in a file

myfile = open("demo.txt", "r")
myline = myfile.readline()
while myline:
    print(myline)
    myline = myfile.readline()
myfile.close()
Posted by: Guest on June-24-2021
2

python read lines

f = open("filename")
lines = f.readlines()
Posted by: Guest on November-16-2020

Python Answers by Framework

Browse Popular Code Answers by Language