You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
15 lines
376 B
Python
15 lines
376 B
Python
import urllib.request
|
|
from datetime import datetime
|
|
import time
|
|
|
|
|
|
while True:
|
|
now = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
|
|
request = urllib.request.Request("http://www.baidu.com")
|
|
with urllib.request.urlopen(request) as response:
|
|
data = response.read()
|
|
content = data.decode("utf-8")
|
|
print(f"{now} {len(content)}")
|
|
time.sleep(1)
|
|
|