llhh
V2EX  ›  问与答

(已解決)enumerate(urls, 1),後面這個數字 1 是何作用呢?

  •  
  •   llhh · Oct 19, 2014 · 2157 views
    This topic created in 4250 days ago, the information mentioned may be changed or developed.
    代碼如下:
    for pos,url in enumerate(urls, 1):
    if lp in url:
    return pos
    else:
    return -1

    google未果,多謝大家!

    原來这个参数用来: 指明索引的起始值
    是enumerate的第二個參數。
    No Comments Yet
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2833 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 15:16 · PVG 23:16 · LAX 08:16 · JFK 11:16
    ♥ Do have faith in what you're doing.