摘要: 1 class DoubleQueue(object): 2 '''实现双端队列''' 3 def __init__(self): 4 self.__lst = [] 5 # 创建一个容器容纳队列成员 6 7 def append_frontdata(self,data): 8 '''在头部添加元素 阅读全文
posted @ 2020-04-15 19:26 Hany47315 阅读(130) 评论(0) 推荐(0)
摘要: 1 class Queue(object): 2 '''实现队列''' 3 def __init__(self): 4 self.__lst = [] 5 # 创建一个容器容纳队列成员 6 7 def append_data(self,data): 8 # 添加元素 9 self.__lst.app 阅读全文
posted @ 2020-04-15 17:58 Hany47315 阅读(102) 评论(0) 推荐(0)
摘要: lst = [1,2,3,2,1,5,5] lst = list(filter(lambda x:lst.count(x) != 1,lst)) lst 运行结果: [1, 2, 2, 1, 5, 5] 2020-04-15 阅读全文
posted @ 2020-04-15 15:24 Hany47315 阅读(137) 评论(0) 推荐(0)
摘要: 1 class Stack(object): 2 '''创建一个栈''' 3 def __init__(self): 4 self.__lst = [] 5 # 将列表设置为私有,不让外界进行访问 6 7 def add(self,data): 8 '''在尾部添加元素''' 9 self.__ls 阅读全文
posted @ 2020-04-15 14:33 Hany47315 阅读(116) 评论(0) 推荐(0)
摘要: 1 import MySQLdb 2 # 导入 MySQL 库 3 4 class MysqlMethod(object): 5 def __init__(self): 6 # 前提:能够连接上数据库 7 self.get_connect() 8 9 10 def get_connect(self) 阅读全文
posted @ 2020-04-15 13:00 Hany47315 阅读(312) 评论(0) 推荐(0)