Python3 solve 'utf-8' codec can't decode byte 0x8b in position 1: invalid start byte

One 、 problem

request.Request(url,headers=headerDict)) There is an exception message when the system is running :'utf-8' codec can't decode byte 0x8b in position 1: invalid start byte

Two 、 Solution

http In the head headerDict Parameters : "Accept-Encoding": "gzip, deflate",

On behalf of the local can receive compressed format of data , The server compresses the large files and sends them back to the client ,IE After receiving, the file is decompressed locally .

The reason for the error is that your program did not unzip the file , So there's no problem deleting this line .

Python3 solve 'utf-8' codec can't decode byte 0x8b in position 1: invalid start byte More articles about

  1. Python3 Use requests request , Error decoding :'utf8' codec can't decode byte 0x8b in position 1: invalid start byte

    requests The response content of the request can be obtained through several properties : response.text For the decoded content , The decoding will be based on the response HTTP Header Medium Content-Type Choose character set . for example "'C ...

  2. solve 'utf-8' codec can't decode byte 0x8b in position 1: invalid start byte

    "Accept-Encoding": "gzip, deflate", This message represents that data in compressed format can be received locally , The server compresses the large files and sends them back to the client ,IE ...

  3. Use Python encounter :'utf-8' codec can't decode byte 0x8b in position 1: invalid start byte problem

    View your HTTP Whether the head has the following head information :"Accept-Encoding": "gzip, deflate" This message represents that data in compressed format can be received locally , And the server is ...

  4. 【python】UnicodeDecodeError: 'utf-8' codec can't decode byte 0x8b in position 1: invalid start byte

    header Kill... In the middle of the war "Accept-Encoding": "gzip, deflate, br", Be careful :

  5. Use Visual Studio 2015 + Python3.6 + tensorflow Build a neural network to make mistakes :'utf-8' codec can't decode byte 0xcc in position 78: invalid continuation byte

    Use Visual Studio 2015 + Python3.6 + tensorflow Build a neural network to make mistakes :'utf-8' codec can't decode byte 0xcc in pos ...

  6. 【 resolved 2】pyinstaller UnicodeDecodeError: ‘utf-8’ codec can’t decode byte 0xce in position 110: invalid continuation byte

    python pack exe Decoding error problem       Recently I did a small project , Among them, I wrote python Pack it up exe file . I use it pyinstaller. Just package the main program py The document ok. In the process of packing , Meet a ...

  7. 【 resolved 】pyinstaller UnicodeDecodeError: ‘utf-8’ codec can’t decode byte 0xce in position 110: invalid continuation byte

    Reprinted from the diligent little frog this article link address : [ resolved ]pyinstaller UnicodeDecodeError: ‘utf-8’ codec can’t decode byte 0xce in positi ...

  8. Python3 Use requests request , Error decoding :'utf8' codec can't decode byte 0x83 in position 1: invalid start byte

    requests The response content of the request can be obtained through several properties : response.text For the decoded content , The decoding will be based on the response HTTP Header Medium Content-Type Choose character set . for example 1 " ...

  9. python3 Report errors :UnicodeDecodeError: 'utf-8' codec can't decode byte 0xd6 in position 201: invalid continuation byte

    Code : # -*- coding:utf-8 -*- from urllib import request resp = request.urlopen('http://www.xxx.com') p ...

Random recommendation

  1. Jqplot Use summary 2 ( double Y Axis )

    Need to use... Recently Jqplot Do double Y The shaft Chart chart , First of all, I found the example in the document and made some adjustments to the data : 1. Examples show : var s1 = [["2002-01-01", 112000], [ ...

  2. react Scaffolding

    1.npm install -g create-react-app 2.create-react-app react-demo 3.cd react-demo 4.npm start

  3. goroutine Knowledge point

    goroutine: A coroutine is a lightweight thread in user mode : Between the two , Communicating through messaging ( Most languages communicate through shared memory ) select Scenarios used : To handle business normally routine sign out ( Overtime . Not meeting certain conditions ...

  4. mongoDB And mongoose

    mongodb It is a document database based on distributed file storage MongoDB Is a product between relational and non-relational databases MongoDB The biggest feature is that the query language he supports is very powerful , It also supports indexing data official ...

  5. [LeetCode&Python] Problem 257. Binary Tree Paths

    Given a binary tree, return all root-to-leaf paths. Note: A leaf is a node with no children. Example ...

  6. python Built in functions ,lambda expression , File read and write

    Lambda expression : lambda It's an anonymous function , Automatic addition return return a={ 6:2,8:0, 1:4,-5:6,99:11,4:22} print(sorted(a.items()))# Press key row ...

  7. 16 A cool one jQuery plug-in unit

    Abstract : All of the following plug-ins have great functions , I believe most of them will help you with your upcoming projects . With them, you can make your website more colorful . Lens Flare in JavaScript This jQuery Plugins can help you process images , ...

  8. rewrite or internal redirection cycle while processing "/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/jenkins/

    It's been a long time , Follow nginx Configuration doesn't matter . In the end, I put php Version from 7.1 drop to 5.6 Just solved , with tp3.2 Matching

  9. Django-session Simple analysis of middleware source code

    Django-session Simple analysis of middleware source code settings Configuration of Middleware in MIDDLEWARE = [ 'django.middleware.security.SecurityMiddlew ...

  10. vba Realization excel Merging multiple tables

    Excel Multi table merging vba Realization demand Keep the list , Copy every one of them excel The data in , Merge into one excel Operation steps Put the files to be merged in the same folder , Just copy it (ps: It's better not to operate the original data file directly , Avoid loss of operation ...