Python returning “ – How can I access this?

It doesn’t print a simple list because the returned object is not a list. Apply the list function on it if you really need a list.

print list(itertools.combinations(number, 4))

itertools.combinations returns an iterator. An iterator is something that you can apply for on. Usually, elements of an iterator is computed as soon as you fetch it, so there is no penalty of copying all the content to memory, unlike a list.

Leave a Comment

tech