There’s only one line in that file, and you just read it. readlines returns a list of all the lines. If you want to re-read the file, you have to do file.seek(0)
More Related Contents:
- Fanny’s Occurences
- Non-blocking console input?
- Python Finding Prime Factors
- AttributeError: ‘module’ object has no attribute
- What is the use of join() in Python threading?
- What is the difference between flatten and ravel functions in numpy?
- Base 62 conversion
- Problems with pip install numpy – RuntimeError: Broken toolchain: cannot link a simple C program
- What is the most efficient way to get first and last line of a text file?
- ImproperlyConfigured: You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings
- SMTPAuthenticationError when sending mail using gmail and python [duplicate]
- str.strip() strange behavior
- removing time from date&time variable in pandas?
- exec() and variable scope [duplicate]
- warning about too many open figures
- Django Admin – change header ‘Django administration’ text
- pip install: Please check the permissions and owner of that directory
- Python 3D polynomial surface fit, order dependent
- How do I check (at runtime) if one class is a subclass of another?
- Python – IOError: [Errno 13] Permission denied:
- What does Python optimization (-O or PYTHONOPTIMIZE) do?
- How to group elements in python by n elements [duplicate]
- String Replacement Combinations
- How do you add additional files to a wheel?
- How do I remove the light grey border around my Canvas widget?
- How to find the shortest string in a list in Python
- Does range() really create lists?
- Controlling Yaml Serialization Order in Python
- How to iterate over a dictionary
- how to count the total number of lines in a text file using python