Python--list (list)

Source: Internet
Author: User
Tags string methods python list

Access and modification of list

LI1 = ["Hello","Jiao", -];li1[2] =990; #修改列表元素del (li1[1]); #删除列表元素 # li1[1:2] =[];p rint (LI1); #['Hello',990]print (len (li1)); #2print (Type (LI1)); #<class 'List'>

List methods and string methods are broadly consistent, note that the deletion of list elements must be written

list[n:n+1] = [];

It's not possible to write anything else. You might replace this element with a list, an empty string. Because the elements in the list can be modified.

Python List script operators

Python list interception and splicing

Nesting of lists

LI1 = ["Mr jiao", ["violin""coding " Japanese"];p rint (li1[2] [2]) ;   #japanese

List method

Reference: Python3 List

Python--list (list)

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.