[PYTHON] Basic Learning

Source: Internet
Author: User

Most of the same as other languages do not do more than repeat, to extract some different points of record.

1.list

The list is translated into lists, which are an ordered set of collections that can be added, deleted.

Unlike the base language C language, and so on, the list is like an array object and encapsulates some methods.

The list is also not allowed to cross the border, but the list can be counted backwards, such as the first list[-1]

Then the list subscript value range is:-len-------len-1

Method of 2.list

(1) Append method, insert at the end:

Lisrt.append (' Skdj ')

(2) Insert method, with index number inserted

List.insert (1, ' sjdkj ')

(3) Pop method, use index number to delete, default is 0.

List.pop ()

Features of the 3.list

(1) The element types in the list can be different

Example: list1=[' DSJK ', 123,true]

Of course lists can also be found in the list

list2=[' DSJK ', [1,2],true]

list2=[' DSJK ', list1,true]

2.tuple

The name of this ordered list is called: the ancestor, and the list is very similar, but the tuple can not be modified to initialize.

[PYTHON] Basic Learning

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.