Python Learning: Tuple tuples

Source: Internet
Author: User

1Tuple definitions:
    1. Description: Tuples can not be modified, usually enclosed in parentheses.
    2. Example:
#一般元组>>> 1 (2, 3) >>> (1, 2, 3)#一个元素的元组>>> (1,) (1,) >> > 2, (2,)#空元组 #元组的乘法
2Tuple function
    1. Description: Converts a sequence to a tuple, using a series parameter;
    2. Example:
>>>tuple("CONSTANT")(' C ',' O ',' N ',' S ',' T ',' A ',' N ',' T ') >>>tuple(List("CONST"))(' C ',' O ',' N ',' S ',' T ') >>>
3The meaning of the tuple:
    1. Tuples can be used as keys in mappings;
    2. Tuples exist as return values for many of the built-in functions and methods.

Python Learning: Tuple tuples

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.