iteration, list, dictionary, file iteration

for i in k :i=k_iter_()

# f=open('dog.txt','r',encoding='utf8')#If the file does not exist, you can create a new file 
# f.seek('Hello',1)#Search through the seek cursor 
# print(f .tell()) #Iteration 
: the for loop follows the iterator, it can only go forward but not backward, 
# k=[1,2,3] 
# for i in k:#i=k._iter_() 
#      print( i) 
# k = [1, 2, 3, 4] 

# # print(k[0]) # index = 0 # while index < len(k): # print(k[index]) # index += 1 # dic={'a':2,'b':7}#Dictionary iteration # res=dic.__iter__() # print(res.__next__()) f=open( ' eze.py ',' r+ ' ) #File iteration operation # for i in f res=f. __iter__ () print (res. __next__ (),end= ' 2 ' ) k = [1, 2, 3, 4] #List iteration # iter_1=k.__iter__() # Follow the iterator protocol to produce iterable objects # print(iter_1.__next__())#Get the value of the object list # print(iter_1 .__next__())#Get the value of the object list

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325123514&siteId=291194637