Usage of pop () and split () in Python

Source: Internet
Author: User

1Imglist = ['11.jpg','12.jpg','13.jpg','14.jpg','2.jpg','1.jpg',]2 Print(str (imglist))3A = str (imglist). Split (".")4 Print(a)5Ftail =A.pop ()6 Print("-------------------")7 Print(Ftail)8 Print("----$%%%%%%%%---")9 Print(a)Ten  One #alist = [123, ' xyz ', ' Zara ', ' abc '] A #print ("A List:", Alist.pop ()) #默认去除最后一个元素, prints out a list:abc - #print ("B List:", Alist.pop (2)) #去除下标为2的元素, prints out b list:zara - #print (alist) #打印出 [123, ' XYZ '] the  - #!/usr/bin/python3 -  -str ="This is a string EXAMPLE....WOW!!!" + Print(Str.split ()) - Print(Str.split ('I', 1)) + Print(Str.split ('W'))

Prints the result as

D:\software\python\python.exe d:/software/pycharmpython/login/bbb.py['11.jpg','12.jpg','13.jpg','14.jpg','2.jpg','1.jpg']["[' One","jpg ', '","jpg ', '","jpg ', '","jpg ', ' 2","jpg ', ' 1","jpg ']"]-------------------jpg']----$%%%%%%%%---["[' One","jpg ', '","jpg ', '","jpg ', '","jpg ', ' 2","jpg ', ' 1"][' This',' is','string','EXAMPLE....WOW!!!']['th','S is string EXAMPLE....WOW!!!']['This is string example ....','o','!!!']process finished with exit code 0

Usage of pop () and split () in Python

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.