- those in python can use for loops, and those can traverse?
答:iterable objects or objects that umplenment iterator protocols can be traversed
probably include: dictionary,list,string,file,tuple
2.it’s wrong to ttraverse the dictionary table like this - all objects that can be iterated are due to the existence of a next function, which is used in the follwing ways
- instead of using f.readlines() to iterate in actual development, use f directly or new method , which takes up less internal memory
- what objects can be iterated?
an object that contains the next method is an iterative object - to determine whether an object uses a method,use is an follows
- objects paid by files can only be used once
10. - add iters method to urls,which can be used to implement next() function
- summary
15. - making elements capitalized or filtering certain elements
- other silly ways
- example of map() and zip()
- summary
相关文章: