- 博客(3)
- 收藏
- 关注
原创 Python练习(3)文本统计、文件遍历
1 对文本的简单统计 f=open('/home/ft/Downloads/this.txt','r') a={} for i in f.read(): if(i in a): a[i]+=1 else: a[i]=1 b=sorted(a) for k in b: print(k,': ',a[k]) 2 一个Python小程序,简单实现tree的功能 2.1 tree 的调...
2019-11-06 00:56:50
417
原创 Python练习(2): os与cv2
Python练习(2): os与cv2 1.1 批量对文件的重命名 import os def renamefile(dest_path):#rename files under dest_path filelist=os.listdir(dest_path) os.chdir(dest_path) for tfile in filelist: os.rename(tfile,'new...
2019-10-30 18:22:32
555
2
原创 python练习(1)
Python (1) 1 文件操作 1 创建文件 open()函数 open(file,mode ,buffering=-1, encoding=None, errors=None, newline=None, closefd=True, opener=None) 不同mode打开文件的完全列表: 模式 描述 t 文本模式 (默认)。 x 写模式,新建一个文件,如果该文...
2019-10-22 12:37:10
425
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人