标签:div code sci amp extend 合并 color reverse ascii码
# -*- coding:utf-8 -*- # 排序默认按照 ASCII码 排序。 # 符号在前,大写在后,小写再大写后面。 # sort 排序 L1 = [‘a‘,‘c‘,‘v‘,‘s‘,‘g‘,‘t‘,‘A‘,‘#‘,‘&‘,] L1.sort() print("结果:",L1) print("----- end -----") 结果: [‘#‘, ‘&‘, ‘A‘, ‘a‘, ‘c‘, ‘g‘, ‘s‘, ‘t‘, ‘v‘] ----- end -----
# reverse 倒序。 L1 = [‘a‘,‘c‘,‘v‘,‘s‘,‘g‘,‘t‘,‘A‘,‘#‘,‘&‘,] L1.reverse() print("结果:",L1) print("----- end -----") 结果: [‘&‘, ‘#‘, ‘A‘, ‘t‘, ‘g‘, ‘s‘, ‘v‘, ‘c‘, ‘a‘] ----- end -----
# extend 合并列表
L1 = [‘a‘,‘c‘,‘v‘,‘s‘,‘g‘,‘t‘,‘A‘,‘#‘,‘&‘,]
L2 = ["11","22","33",]
L1.extend(L2)
print("结果:",L1)
print("----- end -----")
结果: [‘a‘, ‘c‘, ‘v‘, ‘s‘, ‘g‘, ‘t‘, ‘A‘, ‘#‘, ‘&‘, ‘11‘, ‘22‘, ‘33‘]
----- end -----
标签:div code sci amp extend 合并 color reverse ascii码
原文地址:https://www.cnblogs.com/boc1023/p/9689332.html