llhh
V2EX  ›  问与答

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

  •  
  •   llhh · Oct 19, 2014 · 2164 views
    This topic created in 4253 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   ·   1134 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 18:13 · PVG 02:13 · LAX 11:13 · JFK 14:13
    ♥ Do have faith in what you're doing.