Python tuple operations

Source: Internet
Author: User

Features: cannot be changed (as with strings.) Not allowed to delete and modify)

Operation:
1, print can be used with% of the Gansoprint( ‘%s is %d years old‘ % (name, age))

2. Indexed like a list

3, define an element, (1,), (1) is an int number

4, the list of the tuple can be modified (each element of a tuple, pointing to never change)

Eight, tuple built-in functions
The Python tuple contains the following built-in functions
1. CMP (Tuple1, Tuple2): Compares two tuple elements.
2. Len (tuple): Calculates the number of tuple elements.
3, Max (tuple): Returns the maximum value of an element in a tuple.
4, min (tuple): Returns the element minimum value in the tuple.
5, tuple (seq): Converts a list to a tuple.

No append (), insert () method

Python tuple operations

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.