常见问题汇总

1、不加

if __name__ == "__main__":

 报错
IndentationError: unexpected indent

eg:

# -*- coding:utf-8 -*-

import requests

r = requests.get('http://www.cnblogs.com/harbin-charles')
code = r.status_code
print(code)

2、for循环的机理(易出错):循环取值不同导致结果也不同

 按索引顺序去取值

3、在python代码里可以用r.content这个方法,content会自动解码gzip和deflate
原文地址:https://www.cnblogs.com/harbin-charles/p/7562932.html