Summary of Python string key points

Source: Internet
Author: User
The Python string key has the following points:

1. Some quotation-delimited characters

You can see the string as a Python data type, a character array between a Python single quote or a double quotation mark, or a sequential character set. The most commonly used quotes in Python are (') and (""). The function of the two is the same, the actual content of the string is the character between the quotation marks, not including the quotation marks themselves.

2. Non-split character type

The string is the only literal character sequence type. However, the character itself is not a type, so the string is the most basic unit of the character store operation.

3. String formatting operator (%) provides functionality similar to printf ()

The string formatting operator provides a flexible way to create a custom string based on a variety of output types, and he provides an interface for formatting operations similar to C + +.

4. Three quotation marks

You can include special characters such as newline carriage return or TAB key in the three quotation marks. Three single quotes ("" ") or double quotation marks (" "" "" ") on each side of the three quotes

5. The original string is used for each special character

This is useful in defining regular expressions.

6.python string does not end with NUL or '/'.

In the C language, strings are used as terminators to prevent cross-border. But in Python, no, you don't have to worry about whether or not you've added a terminator at all. The string value contains what you define, nothing else.

  • Contact Us

    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.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.