且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Python:嵌套计数器

更新时间:2023-12-02 14:47:58

你想要的是 itertools.product

for li, lj, lk in itertools.product(cntr1, cntr2, cntr3):
    print li, lj, lk

将完全按照您的要求进行操作。该名称源于笛卡尔积的概念。

Will do exactly what you are requesting. The name derives from the concept of a Cartesian product.