Answers for "python readline shell"

2

python read lines

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

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
Posted by: Guest on August-02-2021

Python Answers by Framework

Browse Popular Code Answers by Language