Jan 18, 2019 09:36 AM
(This post was last modified: Jan 18, 2019 10:05 AM by Amanththonania.)
Hi.
I'm making a program that reads a specific site and then it writes the whole site to a .txt file.
I want to make it so if the website takes more than 1 second to load it skips and goes to the next site.
My code looks something like this:
I'm making a program that reads a specific site and then it writes the whole site to a .txt file.
I want to make it so if the website takes more than 1 second to load it skips and goes to the next site.
My code looks something like this:
Code
import urllib.request
Number = 123
url = "http:/website.com/number={}"
while True:
read = urllib.request.urlopen(url.format(x)).read()
text_file = open("text.txt", "ab")
text_file.write(read)
text_file.close()
print(read)
Number = Number + 1

![[Image: 0DvFxnA.gif]](https://i.imgur.com/0DvFxnA.gif)