本文总结于智普教育:
做点小东西,有成就感,才会有动力学下去哈!
先上代码:
1: import webbrowser as web
2: import time
3: import os
4: count = 1000
5: i = 0
6: while i <=count:
7: j = 0
8: while j <= 9:
9: web.open_new_tab('http://blog.sina.com.cn/s/blog_4701280b0102eo83.html') #博客地址
10: j = j + 1
11: time.sleep(1)#每打开一个网页,等网页缓冲完再继续
12: else:
13: os.system('taskkill /F /IM baidubrowser.exe') #系统调用,taskkill 关闭.exe
14: print i+1, 'times closing Browser!'
15: i = i + 1
16: time.sleep(5)
注意:在连续打开几个网页之后,要先把浏览器关掉释放内存,否则内存耗尽会导致系统崩溃。