Answers for "how to read only 1line in a file in python"

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

Code answers related to "how to read only 1line in a file in python"

Python Answers by Framework

Browse Popular Code Answers by Language