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.
20 lines
479 B
Python
20 lines
479 B
Python
import urllib.request
|
|
from datetime import datetime
|
|
import time
|
|
|
|
|
|
while True:
|
|
time.sleep(1)
|
|
now = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
|
|
print(now)
|
|
# try:
|
|
# 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"{len(content)}")
|
|
# except Exception as e:
|
|
# print(e)
|
|
|
|
|