Itertool Chain
Sat 17 May 2025
title: "Itertool Chain" author: "Rj" date: 2019-04-20 description: "List Test" type: technical_note draft: false
from itertools import chain
string = 'Toronto'
chain(string)
<itertools.chain at 0x108ed2ba8>
chars = chain(string)
type(chars)
itertools.chain
chars
<itertools.chain at 0x108ed2b70>
for c in chars:
print(c)
T
o
r
o
n
t
o
for c in chars:
print(c)
# Since the iteration is finished, you can't get the characters one more time
Score: 5
Category: basics