0

I tried to generate permutations by using itertools module but its not working.

>>>print(permutations([1,2,3],3))
<itertools.permutations object at 0xa917c5c>

Why is it so? and how do I make it work properly?

2
Contributors
1
Reply
3
Views
7 Years
Discussion Span
Last Post by slate
0

It works properly, but maybe not as you expect it.

It gives back a generator, not a list
Try:

list(permutations(some sequence))
#or
for perm in permutations(some sequence):
    print perm
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.