摘要:
1、 >>> a = list(range(1,11)) ## 生成列表 >>> a [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] >>> a[::-1] ## 倒序排列 [10, 9, 8, 7, 6, 5, 4, 3, 2, 1] >>> a [1, 2, 3, 4, 5, 6 阅读全文
摘要:
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, 阅读全文