zxCoder
V2EX  ›  问与答

求教个 Python 问题

  •  
  •   zxCoder · Apr 28, 2022 · 694 views
    This topic created in 1525 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   ·   948 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 21:38 · PVG 05:38 · LAX 14:38 · JFK 17:38
    ♥ Do have faith in what you're doing.