Python自学:第五章 列表解析

# -*- coding: GBK -*-
squares = [value**2 for value in range(1,11)]

print(squares)

输出为:

[1, 4, 9, 16, 25, 36, 49, 64, 81, 100]

 

posted @ 2019-05-13 08:45  Johnson蚂蚁  阅读(159)  评论(0编辑  收藏  举报