Reputation: 11
When I use urllib2.urlopen(url).read() I read a source code slightly different from what I read in Firefox. In source code seen in Firefox some special characters, such as quotation marks ("), apostrophe ('), etc are converted to %22, %27 etc.
When I use urllib2.urlopen(url).read(), special characters are readable in clear text. I would like to see the source code of a web page with Python as I see it with Firefox (with% 22,% 27, etc).
Thank you and sorry for my english.
Upvotes: 1
Views: 210
Reputation: 6365
Perhaps that is urlencoded.
You can try to escape the result.
data = urllib2.urlopen(url).read()
print(urllib.quote(data))
Upvotes: 1