readline in a file
myfile = open("demo.txt", "r")
myline = myfile.readline()
while myline:
print(myline)
myline = myfile.readline()
myfile.close()
readline in a file
myfile = open("demo.txt", "r")
myline = myfile.readline()
while myline:
print(myline)
myline = myfile.readline()
myfile.close()
how to use readline in python
myFile = open("test.txt,"r")
print(myFile.readline(0))# print the first line of the text file
print(myFile.readline(1))# print the second line of the text file
print(myFile.readline(2))# print the tird line of the text file
# ect..
# you might need to use MyFile.seek(0) after reading
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us