Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I found this function on the internet:

def combos(els, l):
    if l == 1:
        return [(k,) for k, v in els.items() if v]
    cs = []
    for e in els:
        nd = {k: v if k != e else v - 1 for k, v in els.items() if v}
        cs += [(e,)+c for c in combos(nd, l-1)]
    return cs
print(combos({'a': 2, 'b': 3}, 3))

And now I would like to somehow monitor the current progress of the function. Is that possible? Thanks in advance


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
352 views
Welcome To Ask or Share your Answers For Others

1 Answer

等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...