Oliver_Snow
Oliver_Snow
2019-05-08 11:40

刷阅读量,我多加了个计时,但计时为何没有效果?(啥都不会的小白)

  • python

import time

import requests
from selenium import webdriver

time_start=time.time()

def refresh_html(toutiao_url):
chromedriver = "C:\Program Files (x86)\Google\Chrome\Application\chromedriver.exe"
browser = webdriver.Chrome(chromedriver)
browser.get(toutiao_url)
while True:
time.sleep(1)
browser.refresh()

if name == '__main__':
url = 'https://blog.csdn.net/tintinetmilou/article/details/78962098/'
try:
refresh_html(url)
except:
refresh_html(url)

time_end=time.time()

print('time cost',time_end-time_start,'s')

阅读量是有用的,就是最后不会print程序运行时间,是不是time用法错了?

  • 点赞
  • 回答
  • 收藏
  • 复制链接分享

2条回答