Horje
how to use readline in python Code Example
Read text file line by line using the readline() function
# Program to read all the lines in a file using readline() function
file = open("python.txt", "r")
while True:
	content=file.readline()
	if not content:
		break
	print(content)
file.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




Python

Related
logistic regression python Code Example logistic regression python Code Example
how to copy content of one file to another in python Code Example how to copy content of one file to another in python Code Example
monkey patching in python Code Example monkey patching in python Code Example
python string caps lock Code Example python string caps lock Code Example
learn python 3 Code Example learn python 3 Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
6