This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import itertools | |
l1=itertools.chain(["red","blue"],[1,2,3],"hello") | |
#Returns an iterator object | |
print (l1)#Output:<itertools.chain object at 0x029FE4D8> | |
#converting iterator object to list object | |
print(list(l1))#Output:['red', 'blue', 1, 2, 3, 'h', 'e', 'l', 'l', 'o'] | |
l2=itertools.chain("ABC","DEF","GHI") | |
print (list(l2))#Output:['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I'] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment