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 恶魔的荣耀 阅读(1585) 评论(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 恶魔的荣耀 阅读(1006) 评论(0) 推荐(0)

导航