Python高阶(三) - 个人Pythonic日记

1. 循环遍历可迭代对象(in enumerate) Non-Pythonicpython # 基于索引的while循环 choices = ['red', 'green', 'blue'] i = 0 while i < len(choices): print('{}) {}'.format(i, choices[i])) i += 1 # 或者for循环: choic
相关文章
相关标签/搜索