Beginner Python (eight)--iteration

Source: Internet
Author: User

Beginner Python (eight)--iteration

Beginner Python, mainly finishing some of the learning points, this is an iteration.

#-*-coding:utf-8-*- fromCollectionsImportiterable" "' Iteration" "L= ['af','St',' at','Psst','Beta'] D= {1:'af', 2:'St', 3:' at', 4:'Psst', 5:'Beta'} S='HelloWorld'  #Array forIteminchL:PrintItem#Dictionary forKeyinchD:PrintKey#The default is the key value, you want to take values, call the Itervalues () method forValueinchd.itervalues ():Printvalue#Key,value simultaneously take   forKey,valueinchD.iteritems ():PrintKey,value#string forChinchS:PrintCH#determine if an iteration can be iterated#whether the string iteratesPrintisinstance (s,iterable)#whether an array can be iteratedPrintisinstance (l,iterable)#whether the dictionary can iteratePrintisinstance (d,iterable)#whether decimals can be iteratedPrintIsinstance (11.2, iterable)#whether integers are iteratedPrintIsinstance (1, iterable)#whether Boolean values can be iteratedPrintisinstance (false,iterable)#whether set can iteratePrintIsinstance (Set ([]), iterable)#whether a tuple can iteratePrintIsinstance (), iterable)#Enumerate   forIndex,valueinchEnumerate (L):PrintIndex,value

Beginner Python (eight)--iteration

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.