Home  >  Article  >  Backend Development  >  Summary of key points of Python strings

Summary of key points of Python strings

高洛峰
高洛峰Original
2016-10-17 13:18:041186browse

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 '

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn