A missing iterator on itertools module?

ast none at none.fr
Thu Mar 28 12:45:42 EDT 2024


Hello

Suppose I have these 3 strings:

s1 = "AZERTY"
s2 = "QSDFGH"
s3 = "WXCVBN"

and I need an itertor who delivers

A Q W Z S C E D C ...

I didn't found anything in itertools to do the job.

So I came up with this solution:


list(chain.from_iterable(zip("AZERTY", "QSDFGH", "WXCVBN")))

['A', 'Q', 'W', 'Z', 'S', 'X', 'E', 'D', 'C', 'R', 'F', 'V', 'T', 'G', 
'B', 'Y', 'H', 'N']

Do you havbe a neat solution ?


More information about the Python-list mailing list