参考代码如下:
# -*- coding:utf-8 -*-
import datetime
import time
import urllib.request
url = { '0' : 'https://blog.csdn.net/Fighting_Boom/article/details/88732537', # Linux通用 源码方式安装OpenCV3
'1' : 'https://blog.csdn.net/Fighting_Boom/article/details/82185415', # 树莓派3B+ 安装官方原版系统
'2' : 'https://blog.csdn.net/Fighting_Boom/article/details/87969477', # 百度云资料备份
'3' : 'https://blog.csdn.net/Fighting_Boom/article/details/90256610', # cheese 打开摄像头黑屏
'4' : 'https://blog.csdn.net/Fighting_Boom/article/details/88786412', # vim 设置主题行号
'5' : 'https://blog.csdn.net/Fighting_Boom/article/details/82215362', # 树莓派源码方式安装OpenCV
'6' : 'https://blog.csdn.net/Fighting_Boom/article/details/82737108', # keil4 keil5 兼容安装破解
'7' : 'https://blog.csdn.net/Fighting_Boom/article/details/81534927', # 15指纹识别
'8' : 'https://blog.csdn.net/Fighting_Boom/article/details/81584897', # pycharm 安装破解教程
'9' : 'https://blog.csdn.net/Fighting_Boom/article/details/83315486', # ESP8266 贝壳物联
'10': 'https://blog.csdn.net/Fighting_Boom/article/details/90607435', # ASCII码表
'11': 'https://blog.csdn.net/Fighting_Boom/article/details/90690630', # ubuntu shell 命令行关机卡死
'12': 'https://blog.csdn.net/Fighting_Boom/article/details/90697499', # ubuntu ping不通win10
'13': 'https://blog.csdn.net/Fighting_Boom/article/details/90747150', # ubuntu 无法联网 目标主机不可达
'14': 'https://blog.csdn.net/Fighting_Boom/article/details/91417400', # windows 搭建SVN服务器
'15': 'https://blog.csdn.net/Fighting_Boom/article/details/91983972', # linux UDP通信 sendto错误
'16': 'https://blog.csdn.net/Fighting_Boom/article/details/91990142', # ubuntu wifi 图标 扇形
}
def getHtml(url):
page = urllib.request.urlopen(url)
html = page.read()
html = html.decode('utf-8')
return html
def main():
for i in url:
getHtml( url[i] )
time.sleep(4)
# time.sleep(47)
while(1):
main()
上边需要加上UTF-8的说明,不然会出现错误。