zxCoder
V2EX  ›  问与答

求教个 Python 问题

  •  
  •   zxCoder · Apr 28, 2022 · 684 views
    This topic created in 1513 days ago, the information mentioned may be changed or developed.

    比如输入 4 个列表

    [1, 2, 3, 4]
    ['a', 'b']
    ['one','two','three','four']
    [666,555]
    

    现在想得到一个笛卡尔积的子集,比如指定[0,2]这两列,也就是第一和第三个列表是一对一的关系,不参与笛卡尔积。期望输出

    1   a one  666
    1   a one  555
    1   b one  666
    1   b one  555
    2     two
    ...
    3     three
    ...
    4     four
    ...
    

    就是每一行里的顺序需要和输入的列表的顺序是一致的

    No Comments Yet
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2503 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 06:02 · PVG 14:02 · LAX 23:02 · JFK 02:02
    ♥ Do have faith in what you're doing.