3.Python Self-Learning path: A list of operating examples

Source: Internet
Author: User
Tags add numbers

1L1 = List (['W','u','W','e','N'])2L1.append ('I')3L1.append (['s','s'])#Append parameters to the original type4L1.append ('SB')5L1.append (6)#You can add numbers6 Print(L1)7 8result = L1.count ('s')9 Print(Result)Ten  One #extend can only add iterable when parameters: Array, string, list AL1.extend ([' the',' the'])#Expand the contents of the parameter -L1.extend (' the')#the string was taken apart. -L1.extend ('999')#can't add a number to the error the Print(L1) -  -result = L1.index ('W')#Find, return subscript - Print(Result) +  -L1.insert (5,'lol') + Print(L1) A  atresult = L1.pop (5)#pops up a 5th element, saved in result - Print(Result) -  -L1.remove (' the')#error if no element exists - Print(L1) -  inL1.reverse ()#Inverted - Print(L1) to  +L1 = List ('5','6','2','3','7'))#Sort - L1.sort () the Print(L1)

3.Python Self-Learning path: A list of operating examples

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.