In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-03 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
Python gives a detailed explanation of Quoted-printable coding and how to use the quopri library. In view of this problem, this article introduces the corresponding analysis and solution in detail, hoping to help more partners who want to solve this problem to find a more simple and feasible method.
I saw a question like this in the group before:
The data obtained by calling the network interface is in the following form:
Text = "" = E5, B7, 9, A0, E4, B8, BA, B, E, B, B, E, B, E, B, B,
= E9 "BA" A6 "E8" BF "AA" E5 "B0" B1 "E4" B8 "8D" E5 "8F" AFE 8 "83" BD "E9" 82 "A3" E5 "88" B0 =
= E6 "80" BBs E5 "86" A0 "E5" 86 "9BZ" E6 "88" 92 "E6" 8C "87" EF "BC" 8C "E8" 80 "83" E8 "99" 91 =
= E5 "88" B0 "E6" 8A "A4" E7 "90" 83 "E9" 97 "AEV" E9 "A2" 98 "EFV" BC" 8C "E5" A6 "82" E6 "9EZ9C =
= E7'94'A8'E9'BA'A6'E8'BF'AA'E6 '8DBA' A2'E4'BA'A8'E5'88'A9'E7'9A'84'E8 'AFE 9D =
= E8 after B4, E4, B8, B6, E5, AE8, B0, B1, E8, A1, 8C, EF, BC, 8C, E5, BDP93E7B4B6 =
= E8 "AF" B8 "E8" 91 "9B" E5 "ADV" 94 "E6" 98 "8E" E8 "BF" 99 "E4" B8 "AA" E8 "80" 81 "E7" 8BI 90 =
= E7 "8B" B8 "E8" 82 "AFM E5" AEN 9A "E6" 98 "AFE" E7 "95" A5 "E6" 87 "82" E8 "BFI 99" E4 "BBV" B6 =
= E4 "BA" 8B "E7" 9A "84" EF "BC" 8C "E4" BBN 96 "E7" ACBA "E4" B8 "80" E4 "B8" AAA E4 "B8" 8D =
= E7 million ADPL 94 E5 BA 94 EFF BCU 8C E5 B0 B1 E7 AEV BBI E4 BBN 96 E7 ADO BAU94 E5BAU94 =
= E4 "BA" 86 "EF" BC "8C" E7 "BC" 9D "E5" B0 "8F" E8 "82" 9BZ" E8 "83" BD" E7 "ADA" 94C "E5" BA "94 =
= E5 "90" 97 "EFs" BC9Fs E6 "89" 80 "E4" BBs A5 "E8" BFs 99 "E6" 95 "B4" E4 "BBs" B6 "E4" BAU8B =
= E6 "83" 85 "E7" 9A "84" E4 "BA" AE "E7" 82 "B9" E5 "B0" B1 "E5" 9C "A8" E4 "BA" 8E "E7" A7A6 =
= E5=A5=8B ""
In fact, this is the text encoded by Quoted-Printable Content-Transfer-Encoding. The purpose of this encoding is to prevent the encoding format from being modified when the text is transmitted. See https://www.freesoft.org/CIE/RFC/1521/6.htm
For this form of encoding, the python built-in library provides quopri with the ability to decode the above text:
Import quopriresult = quopri.decodestring (text) .decode ("U8") result
Because Ding Junhui couldn't get the championship ring only by following Tracy McGrady. Considering the problem of protecting the ball, it might be OK to trade McGrady for Henry. Of course, Zhuge Kongming, the old fox, must have a little understanding of this, and he was the first to say no. Even if he says yes, can you stitch the anus? So the highlight of this whole thing is Qin Fen.
For more information about the quopri module, please refer to: https://docs.python.org/zh-cn/3/library/quopri.html
There are only four ways:
Let's test the code again:
Text = "Test Quoted-Printable\ t Encoding" quopri.encodestring (text.encode ("U8")) b'=E6=B5=8B=E8=AF=95 Quoted-Printable\ tencoding E7 testing BC96coding E7testing A0room81'
The quotetabs parameter indicates whether spaces and tabs are encoded, which are not encoded by default.
Let's test the coding of spaces and tabs:
Quopri.encodestring (text.encode ("U8"), quotetabs=True) bundles E6, B5, 8, B8, B5, B8, B8,
You can see that spaces and tabs are converted to = 20 and = 09, respectively.
The header parameter controls whether spaces are encoded as underscores:
Quopri.encodestring (text.encode ("U8"), header=True) baggage E6, B5, 8, B8, B5, B8, B8, B8,
⚠️ Note: when the quotetabs parameter is set to True, the header parameter is invalid.
The difference between decode and encode and the above method is that the convection object operates.
This is the answer to the question about python's detailed explanation of Quoted-printable coding and how to use the quopri library. I hope the above content can be of some help to you. If you still have a lot of doubts to be solved, you can follow the industry information channel for more related knowledge.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.