I am new to Python and am trying out itertools
:
import itertools as it
obj = it.permutations(range(4))
print(obj)
for perm in obj:
print( perm )
My Question: How do I view/print all the permutations in obj
directly without using a for
loop?
What I Tried:
I tried using __dict__
and vars
as suggested in this SO link but both do not work (former does not seem to exist for the object while latter generated 'TypeError: 'itertools.permutations' object is not callable').
Please pardon if my question is rather noobish - this attributes issue appears complicated and most of what is written in SO link flew over my head.