Created
April 29, 2018 15:00
-
-
Save shau-lok/407a014de199ba2565482bcac1e9332d to your computer and use it in GitHub Desktop.
解决requests 返回的内容编码 (iso-8859-1) 问题
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Refers: https://github.com/requests/requests/issues/1604 | |
# 方法1: | |
r = requests.get('http://irresponsible-server/') | |
r.encoding = 'utf-8' | |
# 方法2: | |
r = requests.get('http://irresponsible-server/') | |
r.encoding = r.apparent_encoding |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment