python - URL returns encoded value when parsed -


i using mechanize open url , i'm parsing beautifulsoup.

br = mechanize.browser() br.addheaders = [('user-agent', 'mozilla/5.0')] url = ('xyz.html') br.open(url) print br.response().read() #prints 4 special characters soup = beautifulsoup(br.response().read())  print soup #prints encoded data 

this problem doesn't occur if copy html file locally , parse it.

should decode/encode once retrieve through mechanize? if so, how should it?


Comments

Popular posts from this blog

1111. appearing after print sequence - php -

excel - I can't get the attachement of the email PHP -

node.js - Express and Redis - If session exists for this user, don't allow access -