python中比較pythonic的地方

變量交換 >>> a, b = b, a 循環遍歷區間元素 >>>for i in range(10): ... print (i) 返回的是生成器對象,生成器比列表更加節省內存python 帶索引位置的循環遍歷 >>>colors = ['red', 'green', 'blue', 'yellow'] >>>for i, color in enumerate(colors): ...
相關文章
相關標籤/搜索