摘要: os.system("系统命令") 调用系统命令 os.listdir(地址) 扫描目录里面的文件。默认的是当前文件夹 返回一个列表 import os # os.listdir(地址) 扫描目录里面的文件。默认的是当前文件夹 print(os.listdir()) # 结果 #当前目录下的文件 [ 阅读全文
posted @ 2018-07-24 10:09 睡觉了嘛 阅读(121) 评论(0) 推荐(0) 编辑
摘要: import codecs # 导入文件 filepath = r"kaifangGood.txt" file = codecs.open(filepath,"rb","utf-8","ignore") #按照指定编码 mylist = file.readlines() # 返回一个list,读取到内存 file.close() print("文件导入成功") #C:\Users\Tsin... 阅读全文
posted @ 2018-07-24 09:45 睡觉了嘛 阅读(252) 评论(0) 推荐(0) 编辑
摘要: 结果 阅读全文
posted @ 2018-07-24 08:36 睡觉了嘛 阅读(88) 评论(0) 推荐(0) 编辑
摘要: # 序列化对象 import pickle mylist=[[1,2,3,4,5,6,7],["abc","xyz","hello"],[1,2,3,4,5,6,7,"我","w"]] file=open(r"G:\我的python\尹成\python基础\day11\文件读写\list.bin","wb") pickle.dump(mylist,file) # 保存list到文件 fil... 阅读全文
posted @ 2018-07-23 11:49 睡觉了嘛 阅读(83) 评论(0) 推荐(0) 编辑
摘要: from string import Template print(type(Template)) mystr = Template("hi,$name 你是$baby") print(mystr.substitute(name = "边真", baby = "lovely ")) # 结果 hi,边真 你是lovely 阅读全文
posted @ 2018-07-23 11:41 睡觉了嘛 阅读(99) 评论(0) 推荐(0) 编辑
摘要: 文件分类的一般流程 事例一. 事例二 事例三 (按照身份证号码取) 阅读全文
posted @ 2018-07-23 11:22 睡觉了嘛 阅读(2816) 评论(0) 推荐(0) 编辑
摘要: 方法一 : 使用python的内置函数 结果 方法2 使用匿名函数 结果 阅读全文
posted @ 2018-07-23 11:16 睡觉了嘛 阅读(258) 评论(0) 推荐(0) 编辑
摘要: 输出结果 阅读全文
posted @ 2018-07-23 11:07 睡觉了嘛 阅读(159) 评论(0) 推荐(0) 编辑
摘要: 1.数据处理之前先进行数据清洗,把自己所需要的好的数据提取出来 2.数据提取,数据清洗之后就要从中提取出自己所需要的部分 3.数据排序 从提取的数据中 按照自己的需要进行排序 4.排序计数 把重复一样的统计出来 5.数据分类 阅读全文
posted @ 2018-07-23 11:06 睡觉了嘛 阅读(144) 评论(0) 推荐(0) 编辑
摘要: 阅读全文
posted @ 2018-07-17 09:43 睡觉了嘛 阅读(95) 评论(0) 推荐(0) 编辑