当前位置:网站首页>Section 19 of Chapter 2: encoding and decoding
Section 19 of Chapter 2: encoding and decoding
2022-07-22 09:50:00 【Zhongyifeng Digital Technology Co., Ltd】
Python Basic introduction ( A full set of nanny level tutorials )
Chapter two
Section 19 : Encoding and decoding
Encoding and decoding
1.str.encode(“ code ”) Encoding
2.bytes.decode(“ code ”) decode
gbk and utf-8 You can't transform directly .
Our army codebook -> written words -> Enemy codebook
s = " Jay Chou "
bs1 = s.encode("gbk") # b'xxxx' bytes type
bs2 = s.encode("utf-8")
print(bs1)
print(bs2)
# How to put a gbk Bytes of into utf-8 Bytes of
bs = b'\xd6\xdc\xbd\xdc\xc2\xd7'
# First become a text symbol ( character string )
s = bs.decode("gbk") # decode
bs2 = s.encode("utf-8") # Recode
print(bs2)
#1.str.encode(" code ") Encoding
#2.bytes.decode(" code ") decode
s = "abcdefg"
print(s.encode("gbk"))
边栏推荐
猜你喜欢
andorid 查看 Activity任务栈
加速企业数据应用创新的核心能力——灵活性
TSP (don't be afraid) dynamic planning (I'm very friendly here)
关于线程 thread (3)线程的同步
Responsive layout viewport and common units
EAS BOS custom export (including excel style setting, multi tab export, export file directory verification and backup)
setAttribute、getAttribute、removeAttribute
Sqlserver copies tables in a database to another database
stm32中的ISP一键下载原理分析
第三章 第一节:函数的概念
随机推荐
Detailed explanation of sticky positioning
微信小程序 路由介绍
关于线程 thread (1)概念简介
Life cycle of Servlet
Wechat applet navigation bar sliding transparency change
关于线程 thread (3)线程的同步
Introduction to MVC framework
call、apply、bind以及bind的兼容问题
24. 合并K个升序链表
生物化学复习题V·酶
并发修改异常
Basic definition and concept of graph (II)
华泰证券远程开户安全吗?有保障吗?
Responsive layout - font common units
产品切换国产芯片步骤,STM32F4切换GD32
Review questions of Biochemistry VIII. Lipid metabolism
33.x 的平方根
Andorid view activity task stack
第二章 第二十三节:文件操作:读
生物化学复习题IV·脂类