 
  Data Structure Data Structure
 Networking Networking
 RDBMS RDBMS
 Operating System Operating System
 Java Java
 MS Excel MS Excel
 iOS iOS
 HTML HTML
 CSS CSS
 Android Android
 Python Python
 C Programming C Programming
 C++ C++
 C# C#
 MongoDB MongoDB
 MySQL MySQL
 Javascript Javascript
 PHP PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
What are the differences between readline() and readlines() in Selenium with python?
The differences between readline() and readlines() methods are listed below.
readlines()
- This method will read the entire content of the file at a time. 
- This method reads all the file content and stores it in the list. 
- This method reads up to the end of the line with readline () and returns a list. 
readline()
- This method will read one line in a file. 
- A new line character is left at the string end and is ignored for the last line provided the file does not finish in a new line. 
- This method reads up to the end of the line with readline() and returns a list. 
Example
Code Implementation with readline()
#open the file for read operation fl = open('pythonfile.txt') # reads line by line ln = fl.readline() while ln!= "": print(ln) ln = fl.readline() #close the file fl.close() Code Implementation with readlines()
#open the file for read operation fl = open('pythonfile.txt') # reads line by line and stores them in list for ln in fl.readlines(): print(ln) #close the file fl.close()Advertisements
 