上一页 1 2 3 4 5 6 7 ··· 14 下一页
摘要: 字段说明 Singer_tb是歌手表,包括的字段有: Sger_id:用于计数和排序 Sger_name:歌手名称 Sger_num:歌手名称对应的编号,可用于多表联查 歌手数量:6位 Album_tb:是专辑表,包括的字段有: Albun_id:用于计数和排序 Album_name:专辑名称 Al 阅读全文
posted @ 2018-04-13 11:04 Bob__Zhang 阅读(2505) 评论(0) 推荐(0) 编辑
摘要: #单例模式 #装饰器版本 def singleton(cls): instances = {} def getinstance(): if cls not in instances: instances[cls] = cls() return instances[cls] return getinstance @s... 阅读全文
posted @ 2018-04-07 22:26 Bob__Zhang 阅读(327) 评论(0) 推荐(0) 编辑
摘要: # b = filter(lambda x:x>5,[1,2,3,4,5,6,7]) # print(list(b)) def filters(x): if x > 5: return x b = filter(filters,[1,2,3,4,5,6,7]) print(list(b))#[6, 7] def maps(x): if x > 5: ... 阅读全文
posted @ 2018-04-07 22:04 Bob__Zhang 阅读(177) 评论(0) 推荐(0) 编辑
摘要: #插入排序算法 def insert_sort(lst): for i in range(1,len(lst)): #开始时片段[0:1]已排序 # print(i) x = lst[i] j = i while j > 0 and lst[j-1] > x: lst[j] = lst[j-1] #反... 阅读全文
posted @ 2018-04-07 14:11 Bob__Zhang 阅读(814) 评论(0) 推荐(0) 编辑
摘要: import itchat from itchat.content import * import re msg_infomation = {} @itchat.msg_register([TEXT]) def handle_receive_msg(msg): msg_from = itchat.search_friends(userName=msg['FromUserName'])['... 阅读全文
posted @ 2018-03-23 21:08 Bob__Zhang 阅读(427) 评论(0) 推荐(0) 编辑
摘要: #此程序需在有网络的条件下运行 import itchat from itchat.content import * import re @itchat.msg_register([TEXT]) def text_reply(msg): print("..%s.."%msg['Text']) #span去除前后空格 再进行匹配 match = re.search('年... 阅读全文
posted @ 2018-03-23 21:06 Bob__Zhang 阅读(337) 评论(0) 推荐(0) 编辑
摘要: #深拷贝 #浅拷贝 #(1)等号 # list1 = [11,22,33,['a','b']] # list2 = list1 # list1.append(44) # print(list1,list2,id(list1),id(list2)) # [11, 22, 33, ['a', 'b'], 44] [11, 22, 33, ['a', 'b'], 44] 43425416 43425... 阅读全文
posted @ 2018-03-23 21:03 Bob__Zhang 阅读(175) 评论(0) 推荐(0) 编辑
摘要: #迭代器 ''' 迭代是访问集合元素的一种方式,迭代器是一个能够记住遍历位置的对象 迭代器对象从集合的第一个元素开始访问,直到所有的元素都被访问完结束 如果想访问一个元素,需要把这个元素前面的所有元素都遍历后,才可以访问 ''' #1.可迭代的对象,像(1),(2)这些对象称之为可迭代对象(Iterable) #(1)以直接作用for循环的数据类型有:list/tuple/dict/set/st... 阅读全文
posted @ 2018-03-23 21:00 Bob__Zhang 阅读(3018) 评论(0) 推荐(0) 编辑
摘要: #斐波那契数列:1,1,2,3,5,8,13... def fib(times): a = 0 b = 1 n = 1 while n <= times: # print(b) #返回加到F生成器中,每次都叠加 yield b a,b = b,a+b n += 1 return... 阅读全文
posted @ 2018-03-23 20:59 Bob__Zhang 阅读(652) 评论(0) 推荐(0) 编辑
摘要: #生成器 ''' 1.什么是生成器 通过列表推导式,可以直接创建一个列表,但是受到内存限制,列表容量肯定是有限的 而且,创建一个包含100万个元素的列表,占用很大的内存空间,如果我们仅仅需要访问 前面几个,后面元素的占用存储空间就被浪费了 所以,如果列表元素可以按照某种算法推算出来,那么我们就可以在循环当中不断地推导它 生产元素,这样就不必创建完整的list,从而大大节省了存储空间 在p... 阅读全文
posted @ 2018-03-23 20:58 Bob__Zhang 阅读(260) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 ··· 14 下一页