Similar question here. You can’t mix iteration and readline so you need to use one or the other.
while True:
line1 = f.readline()
line2 = f.readline()
if not line2: break # EOF
...
More Related Contents:
- Modify tick label text
- Creating a simple XML file using python
- How to validate IP address in Python? [duplicate]
- list to dictionary conversion with multiple values per key?
- Convert UTF-8 with BOM to UTF-8 with no BOM in Python
- Efficient calculation of Fibonacci series
- How to embed HTML into IPython output?
- using requests with TLS doesn’t give SNI support
- What is key=lambda
- Python’s json module, converts int dictionary keys to strings
- Upper memory limit?
- How to build a SystemTray app for Windows?
- How to run Python script on terminal?
- TypeError: ‘dict_keys’ object does not support indexing
- Make dictionary from list with python [duplicate]
- Installed module using pip, not found
- How to map features from the output of a VectorAssembler back to the column names in Spark ML?
- %matplotlib notebook showing a blank histogram
- cx_Oracle error. DPI-1047: Cannot locate a 64-bit Oracle Client library
- How to refer to the class from within it (like a recursive function)
- importing a module in nested packages
- Python Pandas merge samed name columns in a dataframe
- Using Properties in Python classes cause “maximum recursion depth exceeded” [duplicate]
- Is set.pop() deterministic?
- Asking “is hashable” about a Python value
- Clear all widgets in a layout in pyqt
- How to reconstruct a .ui file from pyuic .py file
- How to solve “AttributeError: module ‘google.protobuf.descriptor’ has no attribute ‘_internal_create_key”?
- Using openpyxl to read file from memory
- Numpy.Array in Python list?