2017年9月30日

集合的一些关系运算方法

摘要: {4, 5} {1, 2, 3, 4, 5, 6, 7, 8} {8, 6, 7} 阅读全文

posted @ 2017-09-30 14:39 恶魔的荣耀 阅读(463) 评论(0) 推荐(0) 编辑

2017年5月27日

网络编程(socket)中的粘包处理

摘要: 服务端 阅读全文

posted @ 2017-05-27 07:23 恶魔的荣耀 阅读(291) 评论(0) 推荐(0) 编辑

2017年5月11日

装饰器笔记

摘要: #装饰器的的原理为利用高阶函数和函数相互嵌套完成在不修改原函数代码和调用方法的情况下实现新的功能#函数其实也是一个变量不加()的函数名就是这个函数的内存地址而完整的函数名则是执行这个函数import timedef timer(func): #高阶函数 :实参为函数名,返回值也为函数名 def te 阅读全文

posted @ 2017-05-11 20:56 恶魔的荣耀 阅读(184) 评论(0) 推荐(0) 编辑

2017年5月9日

python3中各个字符编码的转换

摘要: a='我很好' ####python3 默认的编码为unicode###unicode>gb2312unicode_gb2312=a.encode('gb2312') ###因为默认是unicode所以不需要decode(),直接encode成想要转换的编码如gb2312print('我的gb231 阅读全文

posted @ 2017-05-09 20:13 恶魔的荣耀 阅读(22616) 评论(1) 推荐(1) 编辑

2017年5月8日

集合(set)的一些常用方法

摘要: #####集合的一些常用方法#####list1=set([1,2,3,4])list2=set([1,2,3,4,5,6])###集合的交集(返回两个集合里面共同有的部分){1, 2, 3, 4}print(list1.intersection(list2))###集合的并集(返回合并两个集合去掉 阅读全文

posted @ 2017-05-08 19:33 恶魔的荣耀 阅读(1567) 评论(0) 推荐(0) 编辑

字符串strip(),和split()的实际应用

摘要: shop_list=[]shop_cart=[]product_list=open("test.txt",'a+') #读取文件中的商品product_list.seek(0,0)for line in product_list.readlines(): (product,price)=line.s 阅读全文

posted @ 2017-05-08 11:31 恶魔的荣耀 阅读(961) 评论(0) 推荐(0) 编辑

导航