Get the App
SLTechnology News&Howtos  ›  Servers  › 

How does python transcode his name?

Shulou Source: shulou.com Published: 2022-06-01 03:07:10 09月19日 Update

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.

Tags: Elements bytes binary content name location index output three dictionaries parentheses data more times knowledge articles coding industry information information channels Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno MySQL Xiaomi Linux Shulou Technology MariaDB