May-18-2018, 04:15 PM
(May-18-2018, 03:47 PM)wavic Wrote: This is because the iterator ( 'f' is exhausted ). During the reading from a file ( the for loop ) store the line in a list or a dictionary or a set ) so you can use it later. Or you can use f.readlines() method which will create a list and iterate over the list instead of 'f'.data = f.readlines() for line in data: # ...
Hi wavic!
Thanks for your reply,
As you mentioned the word "Exhausted" does that meant by "Used up the storage" right?
Therefore, would it be possible to use once again?
I used your suggestion the f.readlines() method.
However, it could not execute the "Enter a country name (x to Exit):".