Summary of key points of python strings and key points of python strings
The key points of a python string are as follows:
1. Some characters separated by quotation marks
You can see that the string is a data type of Python. It can be seen that it is a character array or a continuous character set combination between Python single quotes or double quotes. The most common quotation marks in python are ('') and (""). The two functions are the same. The actual content of a string is a character between the quotation marks and does not contain the quotation marks themselves.
2. The separators are not allowed.
A string is a unique literal Character Sequence type. However, the character itself is not a type, so the string is the most basic unit of character storage operations.
3. the string formatting operator (%) provides functions similar to printf ()
The string formatting operator provides a flexible way to create custom strings Based on Multiple output types. It provides interfaces similar to C/C ++ formatting operations.
4. Three quotation marks
Three quotation marks can contain special characters such as line breaks, carriage returns, and tab keys. Three single quotation marks (''') or double quotation marks ("""""")
5. The original string uses its original intent for each special character
This is very useful in defining regular expressions.
6. the python string does not end with NUL or '\ 0'.
In C, the string '\ 0' is used as the terminator to prevent cross-border attacks. But in python, no, you do not need to worry about whether the terminator has been added. The string value contains what you define, nothing else.