2013年3月14日
摘要: 其他语言中遍历数组:for (int i = 0; i < list.Length; i++){ System.out.println(list[i]);} python中遍历数组:for item in sequence: print item但是python上面的方法不能取到索引,需要取到索引索引可以:for index in range(len(sequence)): print index,sequence[index]更简单的办法为:for index, item in enumerate(sequence): print index, item 阅读全文
posted @ 2013-03-14 15:49 呆头龙 阅读(71342) 评论(0) 推荐(5) 编辑

点击这里给我发消息