python -> combinations of numbers and letters

前端 未结 4 807
醉话见心
醉话见心 2020-12-18 17:36
#!/usr/bin/python
import random
lower_a = [\'a\', \'b\', \'c\', \'d\', \'e\', \'f\', \'g\', \'h\', \'i\', \'j\', \'k\', \'l\', \'m\', \'n\', \'o\', \'p\', \'q\', \'r         


        
4条回答
  •  伪装坚强ぢ
    2020-12-18 17:49

    Take a look at function combinations in the module itertools (http://docs.python.org/library/itertools.html#itertools.combinations)

    import itertools
    ... setup all ...
    for ilen in range(1, len(all)):
      for combo in itertools.combinations(all, ilen):
        print combo
    

提交回复
热议问题