Reply content:
You're the only one to thank the bad guys ...
Why do you have to be so impatient to learn, the foundation is not solid ah, too aggressive, it is clear that there is no clear idea ...
The first programming to have the default encoding, that is, at the beginning of the file plus
# -*- coding: utf-8 -*-
You are Python2 code before add # Coding:utf-8
See three articles from Python training Huanggo
Python Development crawler Chinese character coding is no longer a problem:
will be python2 Chinese characters will appear garbled things once said clearly
Article/python_bianma.md at Master Pythonpeixun/article GitHub
Python crawler access to multiple websites, Chinese encoding processing.
Python crawler access to multiple websites, Chinese encoding processing.
Python3 access to Sina home Chinese processing
Python3 access to Sina home Chinese processing
It may be lost in the place where you turn around.
ur = list (ur)
ur = ur[:-1]
****************
ur = res.contents[0] ur = list(ur) ur = ur[:-1] temp = unicode(ur[0]) for index in range(0, len(ur), 4): temp = unicode(ur[index]) print temp.strip() print ur[index+1].string print ur[index+1]['href'] print '\n'
It seems response back with two decode behind a change encode should be good ...
Decode is to turn the parentheses into Unicode.
Encode is Unicode turned into parentheses, that is UTF-8
Unicode is a transit point.
No more, the same building ignore ... Or use the Requests library to handle HTTP requests.