02, iterator Objects that can be iterated:Internal containing __iter__ follows an iterative protocol# Print (dir (' 123 ')) # ' __iter__ '# print (' __iter__ ' in Dir ([1, 2, 3])# Print (' __iter__ ' in dir ({' name ': ' Alex '})# print (' __iter__ ' in dir ({' name '})#) # Print (' __iter__ ' in Dir ((1, 2, 3))# print (' __iter__ ' in Dir (1)) # False# c15> print (' __iter__ ' in Dir (True)) # False iterator: An iterative object. __iter__ () can be converted to an iterator that sati
The first section decorator Review and Knowledge reserve------------The first section of the decorator Review and Knowledge reserve------------def wrapper (*args,**kwargs): index (*ARGS,**KWARGS) # * is the role of breaking the positional parameters to the value of args=[a,b,c]# * * The function is to break the keyword parameters to Kwargs=[a,b,c]def index (A,B,C): print (a,b,c) wrapper (' TT ', ' pppp ', c= ' VVV ') Two: Functions can be passed as data. A function can pass as a parameter
-1: + yieldP - Else: + forResultinchQueens (num, state+[P]): A yield[result, p] at - - def play3 (l): - """ - to crack a sub-list in the returned results list - """ in Try: - Try: L +"' to except Typeerror:pass + Else: Raise TypeError - forIinchL: the forSinchPlay3 (i): * yields $ except TypeError:Panax Notoginseng yieldL - the def printqueens (l): + "
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:
[email protected]
and provide relevant evidence. A staff member will contact you within 5 working days.