采用万金油方式 page.encode('').decode('')
import requests
import re
def getIDCard():
url = 'http://shenfenzheng.293.net/'
htmlPage = requests.get(url).text
htmlPage = htmlPage.encode(requests.get(url).encoding).decode(requests.utils.get_encodings_from_content(htmlPage)[0])
print(htmlPage)
idCards = re.findall(r'\D{3,5}\d{17,18}x?',htmlPage)
idCard = idCards[1].split(' ')
print 'a ',idCard,idCard[0]
return idCard
if __name__ == "__main__":
a=getIDCard()
print a[0]