python中for循环打印索引 for index, item in enumerate(Foo()): print "index: ", index, " item: ",item 注意: 要用enumerate,即可支持索引,否则会报错