Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How does python transcode his name?

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

Today, I will talk to you about how python transcodes his name. Many people may not know much about it. In order to make you understand better, the editor has summarized the following content for you. I hope you can get something according to this article.

Append appends backwards

The number of times the count element appears

Iterable iteratable

Extend expansion, batch increase

Index gets the index position of the specified element

Insert inserts data into the specified index location

Pop removes the last element from the original list and assigns it to A1

Remove removes an element

Reserve flips all elements

Tuples are almost the same as lists. Lists can be modified, but tuples cannot be modified.

Curly braces are used at the end of the dictionary, in which each element consists of a key-value pair, followed by a comma (I forgot to add my mistake, looking for mistakes for a long time)

# UTF8 code, three bytes of a Chinese character (jdk is even bytes)

# name = "lilu"

Name = "Li Lu"

For i in name:

Print (I)

Print (bytes (I encoding='utf-8'))

C:\ python36\ python.exe

C:/Users/Administrator/PycharmProjects/q1/zq2.py

Li

B'\ xe6\ x9d\ x8e' #\ x hexadecimal

Dew

B'\ xe9\ x9c\ xb2'

Process finished with exit code 0

Name = "Li Lu"

For i in name:

Print (I)

Bytes_list = bytes (I, encoding='utf-8')

Print (bytes_list)

For b in bytes_list:

# bytes default to hexadecimal

# output default hexadecimal per byte

Print (b)

C:\ python36\ python.exe

C:/Users/Administrator/PycharmProjects/q1/zq2.py

Li

B'\ xe6\ x9d\ x8e'

two hundred and thirty

one hundred and fifty seven

one hundred and forty two

Dew

B'\ xe9\ x9c\ xb2'

two hundred and thirty three

one hundred and fifty six

one hundred and seventy eight

Process finished with exit code 0

Name = "Li Lu"

For i in name:

Print (I)

Bytes_list = bytes (I, encoding='utf-8')

Print (bytes_list)

For b in bytes_list:

# bytes default to hexadecimal

# output default hexadecimal per byte

Print (bbin (b))

C:\ python36\ python.exe

C:/Users/Administrator/PycharmProjects/q1/zq2.py

Li

B'\ xe6\ x9d\ x8e'

230 0b11100110

157 0b10011101

142 0b10001110

Dew

B'\ xe9\ x9c\ xb2'

233 0b11101001

156 0b10011100

178 0b10110010

Process finished with exit code 0

After reading the above, do you have any further understanding of how python transcodes your name? If you want to know more knowledge or related content, please follow the industry information channel, thank you for your support.

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.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report