Python'utf8'编解码器无法解码位置72的字节0xc3:无效的连续字节

穆纳拉然

我正在从google.com抓取特定的网址,但出现了一些错误

'utf8' codec can't decode byte 0xc3 in position 72: invalid continuation byte

代码:

import re
import os
import MySQLdb
import codecs
import requests
import base64
import random
import gzip
import time
from multiprocessing.pool import Pool
import datetime
import time

import sys
reload(sys)
sys.setdefaultencoding('utf-8')
def proxy_mesh():
    while True:
        try: 

            data = requests.get('google.com')

            print data.text.encode('utf-8')
        except Exception, e:
            print e
            print "Trying again"
            time.sleep(3)
proxy_mesh()

什么是FIX,以及如何克服此错误?

马克·托洛宁

保持简单,就可以了。数据已被requests模块解码

import requests
data = requests.get('https://www.whoisxmlapi.com/whoisserver/WhoisService?domainName=http://N%E2%94%[email protected]&outputFormat=json')
print data.text

由于它是JSON响应,因此您可能还需要对其进行处理:

import json
print json.loads(data.text)

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

App Engine-Python:UnicodeDecodeError:“ utf8”编解码器无法解码位置1的字节0xe1:无效的连续字节

'utf8'编解码器无法在python中的解码('utf-8')时解码字节0xc3

UnicodeDecodeError: 'utf-8' 编解码器无法解码位置 3 中的字节 0x95:无效的起始字节 (Python) 套接字编程

Python3:UnicodeDecodeError:'utf-8'编解码器无法解码位置 1 的字节 0x83:无效的起始字节

'utf8'编解码器无法解码位置59的字节0xdf:无效的连续字节

如何处理硒中的奇怪字符?'utf8'编解码器无法解码位置0的字节0xc3:

UnicodeDecodeError:'utf8'编解码器无法解码位置34的字节0xc3:数据意外结束

Python:UnicodeDecodeError:'utf-8'编解码器无法解码字节...无效的连续字节

python UnicodeDecodeError:“ utf8”编解码器无法解码字节

(python / boto sqs)UnicodeDecodeError:'ascii'编解码器无法解码位置5的字节0xc3:序数不在范围内(128)

UnicodeDecodeError:“ utf8”编解码器无法解码位置3-6中的字节:无效数据

UnicodeDecodeError:'ascii'编解码器无法解码位置8的字节0xc3:序数不在范围内(128)

'utf-8'编解码器无法解码LZ4和Python 3.x上位置12的字节0xf0

Robot_framework UnicodeDecodeError:'utf-8'编解码器无法解码位置42的字节0xe0:无效的连续字节

pip install和UnicodeDecodeError:'utf-8'编解码器无法解码位置9的字节0xe0:无效的连续字节

Google SDK gcloud 崩溃(UnicodeDecodeError):“utf8”编解码器无法解码位置 29 中的字节 0xf8:起始字节无效

json.dump-UnicodeDecodeError:'utf8'编解码器无法解码位置0的字节0xbf:无效的起始字节

UnicodeDecodeError:“ utf8”编解码器无法解码位置0的字节0xa5:无效的起始字节

“utf8”编解码器无法解码位置 0 中的字节 0xb5:无效起始字节错误

UnicodeDecodeError:“ utf-8”编解码器无法解码位置6的字节0xe1:无效的连续字节

“utf-8”编解码器无法解码位置 972 中的字节 0xca:连续字节无效:使用 os、shutil、字典移动文件

UnicodeDecodeError:“ utf8”编解码器无法解码位置1的字节0xa9

烧瓶UnicodeDecodeError:'utf-8'编解码器无法解码位置0的字节0xb3:无效的起始字节

UnicodeDecodeError:'utf-8'编解码器无法解码位置1的字节0xe3:无效的继续字节

如何解决UnicodeDecodeError:'utf-8'编解码器无法解码位置3的字节0xa1:无效的起始字节?

PostgreSQL ANSI,Python SQL,utf-8'编解码器无法解码字节0xa0

'utf-8'编解码器无法解码字节-Python

Python UnicodeDecodeError:“ utf-8”编解码器无法解码字节

'utf8'编解码器无法解码字节0xf3