Summary of Python built-in string methods, python strings
String processing is a very common skill, but there are too many built-in string methods in Python that are often forgotten. For quick reference, I wrote examples for each built-in method
>>> "Hello". Encode ("hex")
' 68656c6c6f '
The corresponding can also
>>> ' 68656c6c6f '. Decode ("hex")' Hello '
Check the manuals, and these codec are available.
Codec
Aliases
Operand type
Purpose
Base64_codec
>>> "Hello". Encode ("hex")' 68656c6c6f '
The corresponding can also
>>> ' 68656c6c6f ' decode ("hex")' Hello '
I checked the manuals, and these codec are available.
Codec
Aliases
Operand type
Purpose
Link Source: 58603865*************************************************************************************************************** ****************Key points: 1, then python in the bottom of the byte are encoded, Python2 is the Assic code, Python3
Conversion between commonly used decimal, hexadecimal, string, and byte string in python (new post for a long time)
During protocol parsing, you will always encounter various data conversion problems, from binary to decimal, from byte string to
During network programming, you often need to print the received data in hexadecimal format for easy viewing. Today we found that there is such a simple method in Python.
>>> "Hello". encode ("hex ")'68656c6c6f'
You can also
>>> '68656c6c6f'.
Python formatted stringIn the process of writing a program, it is often necessary to format the output, each time with a check. Just sort it out here for indexing.Format operator (%)"%" is a Python-style string formatting operator, very similar to
A string is a collection of ordered characters used to store and represent text-based information, one of Python's built-in data structures. A string is a sequence of multiple characters, and therefore supports the related operation of a
0x01 backgroundThe day before yesterday in a CTF topic, a blind question, in fact, blinds may also be able to echo the data, such as using DNS or HTTP logs to obtain data quickly, MySQL can use the Load_file () function to read data, and send data
Conversion between commonly used decimal, hexadecimal, string, and byte string in python (updated for a long time)
During protocol parsing, you will always encounter various data conversion problems, from binary to decimal, from byte string to
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.