摘要:
1、>>> a = ["aa","bb","cc","dd"] ## 生成列表 >>> a ['aa', 'bb', 'cc', 'dd'] >>> a = [] ## 清空列表 >>> a []2、 >>> a = ["aa","bb","cc","dd"] ## 生成列表 > 阅读全文
摘要:
>>> a = list(range(1,21)) ## 生成列表 >>> a [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20] >>> a[::2] ## 提取第奇数元素 [1, 3, 5, 7, 9, 阅读全文
摘要:
>>> a = list(range(1,21)) ##生成列表 >>> a [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20] >>> a[:10] ## 提取前10个元素 [1, 2, 3, 4, 5, 阅读全文