zoukankan      html  css  js  c++  java
  • python enumerate

    >>> a = [1, 2, 3]
    >>> for index, item in enumerate(a):
        print index, item    
    0 1
    1 2
    2 3
    >>> b = (1, 2, 3) >>> for index, item in enumerate(b): print index, item 0 1 1 2 2 3
    >>> c = {'a':1, 'b':2, 'c':3} >>> for index, item in enumerate(c): print index, item 0 a 1 c 2 b
    >>> d = "hello world"
    >>> for index, item in enumerate(d): print index, item 0 h 1 e 2 l 3 l 4 o 5 6 w 7 o 8 r 9 l 10 d
  • 相关阅读:
    12月4日
    12月3日
    12月2日
    12月1日
    11月30日
    11月29日
    11月28日
    11月27日
    jquery mobile-按钮控件
    ap web
  • 原文地址:https://www.cnblogs.com/kaituorensheng/p/5309306.html
Copyright © 2011-2022 走看看