
Python
Python
mossbaoo
不积跬步无以至千里,不积小流无以成江海。
展开
-
Python 报错 'urllib' has no attribute 'urlretrieve'
python2与python3的urllib差别在于python3要加上.request比如:import urllib.requesturl = 'http://www.sina.com.cn'local = 'C:/Users/Administrator/Desktop/python/html/sina.html'urllib.request.urlretrieve(url...原创 2019-01-18 10:07:11 · 1048 阅读 · 0 评论 -
Python 报错 IndentationError: expected an indented block
Python中遇到IndentationError: expected an indented block的报错,说明此处需要缩进,你只要在出现错误的那一行,按空格或Tab键缩进就行。有冒号的下一行就要缩进,比如:# 错误if a >= 0:print(a)# 正确if a >= 0: print(a) ...原创 2019-02-22 15:57:31 · 810 阅读 · 0 评论 -
Python 报错 SyntaxError: invalid character in identifier
Python中遇到SyntaxError: invalid character in identifier的报错,说明代码行内有夹杂中文的空格,中文的tab键缩进等,或者非文字字符。比如:# 错误,第二行是中文的tab键缩进if a >= 0: print(a)# 正确,第二行是英文的tab键缩进if a >= 0: print(a) ...原创 2019-02-22 16:05:04 · 1084 阅读 · 0 评论