V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
llhh
V2EX  ›  问与答

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

  •  
  •   llhh · 2014-10-19 21:54:11 +08:00 · 1758 次点击
    这是一个创建于 3550 天前的主题,其中的信息可能已经有所发展或是发生改变。
    代碼如下:
    for pos,url in enumerate(urls, 1):
    if lp in url:
    return pos
    else:
    return -1

    google未果,多謝大家!

    原來这个参数用来: 指明索引的起始值
    是enumerate的第二個參數。
    目前尚无回复
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   2700 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 00:06 · PVG 08:06 · LAX 17:06 · JFK 20:06
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.