Sequence tuple for Python

Source: Internet
Author: User

A tuple, like a list, belongs to a member of a sequence, but the difference is that it is an immutable sequence

Declaration of a tuple:

1. Empty tuple: ()

2, 1 members of the tuple: (1,) or 1,

3. Multiple members: (+) or

Note: When declaring tuples, parentheses are not required, but commas are important, and tuples declaring 1 members must have a comma

Tuple () method

Method Explanation: You can turn other sequences into tuples, and the Usage and list () are consistent

Common operations for other sequences, see

Http://www.cnblogs.com/gametesting/p/7161029.html

The use of basic functions, tuples can be replaced by the list

The meaning of the tuple existence:

1, tuples can be used as keys in the map

2, tuples are many built-in functions and methods as the return value

Sequence tuple for Python

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.