學習Python之餘,分享一個用來刷網頁PV的Python小指令碼.....
[root@huanqiu ~]# cat www.py #!/usr/bin/python # coding: UTF-8 import webbrowser as web import time import os import random data = raw_input('請輸入網址:') count = random.randint (3,5) j = 0 while j <count: i = 0 while i <= 3: web.open_new_tab(data) i=i+1 time.sleep(0.8) else: os.system('taskkill /F /IM chrome.exe') print j, 'times closing Browser !' j = j+1
[root@huanqiu ~]# chmod 755 www.py
執行指令碼,會提示輸入網址,比如輸入http://www.huanqiu.com/
[root@xqsj-beta tmp]# python www.py
請輸入網址:http://www.huanqiu.com/