Python data type

Source: Internet
Author: User

One, Python data type

integer int

String

Lists List

1, the list can be modified

2. The list contains multiple strings

3. The list can be indexed, sliced, indexed starting from 0, 1 for right-to-left

add element functions to the list:

Append (value) adds an element to the list, and the added element is at the end of the list

Insert (subscript, value) adds a value at the specified position, and the original element moves back

list Delete element function

Pop () to delete the element at the specified position

Remove () deletes the specified value

Clear () empties the list value

del empty list

List modification Elements

Direct modification after locating elements

lists[0]= ' 123456 '

List query elements

Use subscript to take the value

Other Functions

1, get the element subscript: index ()

2. Count the number of occurrences of a value in the list, counted ()

3. Reverse the string in the list, reverse ()

4, List sort, sort () ascending order, sort (reverse=true) descending order

5. List 1+ List 2, merge 2 lists

6, List 1*10, List 1 show 10 times

No group

Dictionary

Python data 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.