Python String Type

Source: Internet
Author: User

(1) A string is a series of characters consisting of numbers, letters, and underscores

(2) String support single/double quotes, such as a = ' abc ' or a = "abc" meaning is the same, is to assign ABC to a variable

(3) Strings support three quotation marks, three quotation marks can include single quotation marks and double quotation marks, can also be directly wrapped, such as "" "" Hello ", what ' s your name. ‘‘‘

(4) String support index, using [] index, index value starting from 0, such as the definition of the variable py = python, py[0] to take the first index value, return the result is P

(5) The string supports slicing, using [:] to slice, such as defining the variable py = Python,py[2:5] to take the third index value to the sixth index value, and return the result as tho

(6) plus + for string connection operations, such as PY + thon return result to py Thon

(7) asterisk * for string repetition, e.g. py * Returns the result as Pypypy

Python String Type

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.