Jun-17-2019, 10:16 AM
Hi,
@sodmzs: iterating with
Regards, noisefloor
@sodmzs: iterating with
range(len(..))
and the index over an iterable is an anti-pattern, don't do it. Python support direct iteration:>>> one = ['one', 'o', 'n' ,'e'] >>> two = ['two', 't', 'w', 'o'] >>> for item in one: ... for other_item in two: ... print('{} {}'.format(item, other_item)) ... one two one t one w one o o two o t o w o o n two n t n w n o e two e t e w e o >>>But using itertools as shown is the more elegant way anyway.
Regards, noisefloor