国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > Python > 正文

python encode和decode的妙用

2020-02-23 04:44:43
字體:
來源:轉載
供稿:網友

>>> "hello".encode("hex")
'68656c6c6f'

相應的還可以

>>> '68656c6c6f'.decode("hex")
'hello'

查了一下手冊,還有這些codec可用

Codec

Aliases

Operand type

Purpose

base64_codecbase64, base-64byte stringConvert operand to MIME base64
bz2_codecbz2byte stringCompress the operand using bz2
hex_codechexbyte stringConvert operand to hexadecimal representation, with two digits per byte
idna Unicode stringImplements RFC 3490. New in version 2.3. See also encodings.idna
mbcsdbcsUnicode stringWindows only: Encode operand according to the ANSI codepage (CP_ACP)
palmos Unicode stringEncoding of PalmOS 3.5
punycode Unicode stringImplements RFC 3492. New in version 2.3.
quopri_codecquopri, quoted-printable, quotedprintablebyte stringConvert operand to MIME quoted printable
raw_unicode_escape Unicode stringProduce a string that is suitable as raw Unicode literal in python source code
rot_13rot13Unicode stringReturns the Caesar-cypher encryption of the operand
string_escape byte stringProduce a string that is suitable as string literal in python source code
undefined anyRaise an exception for all conversions. Can be used as the system encoding if no automatic coercion between byte and Unicode strings is desired.
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 彰化县| 赫章县| 高要市| 兴和县| 新平| 吉林市| 德钦县| 竹山县| 海伦市| 孝昌县| 准格尔旗| 崇信县| 泽州县| 黔江区| 衡山县| 保康县| 邵东县| 睢宁县| 浙江省| 荃湾区| 长顺县| 渑池县| 海阳市| 贵港市| 海宁市| 宜都市| 会同县| 阳曲县| 玛纳斯县| 灵寿县| 固原市| 凤凰县| 邵阳市| 清涧县| 揭阳市| 鹤壁市| 高唐县| 凌云县| 固安县| 申扎县| 建始县|