Python Learning note one--string

Source: Internet
Author: User

One. String:

(i) operation of a single element in a string

1. Sequence combinations of single characters (elements).

2. Sequence: The position of a single character

3. Sequence operation: Built-in function len gets length, plus position index

4. Get the elements in the string: Forward index + Reverse Index

(ii) Manipulation of multiple elements in a string: shards

1. X[i:j]: Remove the X from the offset of I, until but not including the element with an offset of J.

2. In one Shard, the left boundary defaults to 0, and the right boundary defaults to the length of the Shard sequence.

3. As a sequence, the string supports merging using the plus sign, or repeating.

(c) The built-in method of the string and the invocation of the function:

1. What methods are supported by the query string: Dir (string variable name)

Dir (s)

2. Query how these methods or functions call: Help (string variable name. Find)

Help (S.find)

3. Specific examples:

(iv) How to write various strings:

1. Backslash escape sequences represent special characters

2. Single quotation mark = double quotation mark

3. Three Quotes

(v) Pattern matching:

1. Import the RE module

。。。。。。

Two. Variable

The python variable does not need to be declared and is created when a variable is assigned to it.

We need to assign an object to a variable to be saved for later invocation

Python Learning note one--string

Related Article

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.