#需要掌握操作
l=[11,"llj","22","haha","llj"]
#count 统计列表中元素出现的次数
# res_int=l.count("llj")
# print(res_int)
#2
#index 根据列表中的元素查看元素的索引
# res_int=l.index("haha")
# print(res_int)
#3
# clear 清空列表元素
# l.clear()
# print(l)
# []
#reverse 把列表元素反转过来
# l.reverse()
# print(l)
# ['llj', 'haha', '22', 'llj', 11]
#sort 只能排序列表中是同一类型的元素
l_s=[11,33,2,-1,9]
# l_s.sort() #默认从小到大排序
# print(l_s)
# [-1, 2, 9, 11, 33]
# l_s.sort(reverse=True) #从大到小排序
# print(l_s)
# [33, 11, 9, 2, -1]
了解
#字符串可以比较大小,按照对应的位置的字符依次PK
#字符串的大小是按照ASCII码表的先后顺序加以区别,表中排在后面的字符大于前面的
# print('a'>'b')
# False
# print('abz'>'abcd')
# True
#列表也可以比大小,原理同字符串一样,但是对应位置的元素必须是同种类型
l1=[1,"abc","zaa"]
l2=[1,"abc","zb"]
# print(l1<l2)
#True
#补充
l_queue=[]
#队列:FIFO,先进先出
#入队操作
# l_queue.append("one")
# l_queue.append("two")
# l_queue.append("three")
# print(l_queue)
#['one', 'two', 'three']
#出对操作
# l_queue.pop()
# l_queue.pop()
# l_queue.pop()
# print(l_queue)
# []
#堆栈:LIFO,后进先出
# l_stack=[]
# l_stack.append("three")
# l_stack.append("two")
# l_stack.append("one")
# print(l_stack)
#['three', 'two', 'one']
#出对操作
# l_stack.pop()
# l_stack.pop()
# l_stack.pop()
# print(l_stack)
# []