Jan-23-2019, 07:17 AM
(This post was last modified: Jan-23-2019, 07:17 AM by CaptainCsaba.)
(Jan-22-2019, 04:20 PM)ichabod801 Wrote: You can only go through a file object once. You do that on line 7 when you use the readlines method. So then on line 18 you read nothing, because you've already read the file.
I would suggest getting rid of urlcount and numberoflines, and looping over the file directly.
with open('input.txt') as url_file: for my_url in url_file: uClient = uReq(my_url.strip()) ...
The idea is great, it's much shorter and easier this way, however, I get a syntax error at the "as" in while open('input.txt') as url_file: thich I don't really understand why. I am using python 3.7.