I'm trying iterate over two lists in python. When I do it the way below it only prints over the first three items in list lstTwo
.
My code looks something like this:
lstOne = ["pmCat","pmDog","pmMouse"]
lstTwo = ['0', '197', '0', '0', '0', '0', '1', '0', '4', '0', '197', '0']
for (y,z) in zip(lstOne,lstTwo):
print(y,z)
I tried zip_longest, but it gives you the entire second list but only the first three out of the first list.
I'm trying to have it print something like:
pmCat 0
pmDog 197
pmMouse 0
pmCat 0
pmDog 0
pmMouse 0
pmCat 1
pmDog 0
pmMouse 4
pmCat 0
pmDog 197
pmMouse 0
pmCat 0
pmDog 197
pmMouse 0
pmCat 0
pmDog 0 pmMouse 0
pmCat 1
pmDog 0
pmMouse 4
pmCat 0
pmDog 197
pmMouse 0
– GenericUser Sep 14 '16 at 09:14