Home > Article > Backend Development > Summary of key points of Python strings
The key points of Python strings are as follows:
1. Some quotation mark-delimited characters
You can think of strings as a data type of Python, an array of characters between Python single quotes or double quotes, or A continuous collection of characters. The most commonly used quotation marks in python are ('') and (""). The functionality of both is the same, the actual content of the string is the characters between the quotes, not the quotes themselves.
2. Inseparable character types
String is the only literal character sequence type. However, characters themselves are not a type, so strings are 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 An interface similar to C/C++ formatting operations.
4. Triple quotes
Special characters such as line feed, carriage return or tab key can be included in triple quotes. Triple quotes are actually three single quotes (''' ''') or double quotes (""" """) on both sides
5. The original string uses its original meaning for each special character
This is Defining regular expressions is very useful.
6.Python string does not pass NUL or '