Answers for "python how to use iter"

5

python how to use iter

s = 'hello'
s_iter = iter(s) #Changes the string to an iterator
print(next(s_iter)) #Will print h
print(next(s_iter)) #Will print e
print(next(s_iter)) #Will print l
print(next(s_iter)) #Will print l
print(next(s_iter)) #will print o
Posted by: Guest on August-05-2020

Python Answers by Framework

Browse Popular Code Answers by Language