Answer the question
In order to leave comments, you need to log in
How to decode cp-1251 to utf-8 on requests?
Python 2.6.6 (r266:84292, Jul 10 2013, 22:48:45)
Here is the code:
#!/usr/bin/python
# -*- coding: utf8 -*-
import requests
import sys
with requests.Session() as s:
r = s.get('http://account.telphin.ru')
print r.text
<a class="asdf" href="http://www.telphin.ru/abonentam/support/#security"><h2>????????! ???????? ????????? ???????????? ????? ???????!</h2></a>
<h1></h1>
<table class="abon_content"><tr>
<h2>???? ?? ???????????? ???????? ????????</h2>
Answer the question
In order to leave comments, you need to log in
stackoverflow.com/questions/7555335/how-to-convert...
decode('cp1251').encode('utf8')
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question