k-combinations in Python 3.x -


what efficient way generate k-tuples k-combinations given python set? there appropriate built-in function? tells me should possible two-line loop.

p.s. did conduct search , found various entries topic "combinations lists, etc in python", proposed solutions seem rather 'un-python'. hoping mind-blowing, idiomatic python expression.

itertools has of types of functions:

import itertools  combination in itertools.combinations(iterable, k):     print(combination) 

Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -