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?
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?
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
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.