Answers for "Readline Python"

0

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
0

Readline Python

f = open("C:\\Users\\Andreea Pantus\\Desktop\\An 2, Semestrul 2\\Inteligenta artificiala, machine learning\\ai-unibuc-24-22-2021\\train.txt", "r")
print(f.readline())
Posted by: Guest on March-26-2021

Python Answers by Framework

Browse Popular Code Answers by Language