摘要: import os #导入OS模块path1=r'C:\Users\chenyu\Desktop\Test' #加r不会进行转义os.mkdir(path1) #创建C:\Users\chenyu\Desktop\Testos.mkdir(r'G:\Test') #创建G:\Test目录os.rmd 阅读全文
posted @ 2020-07-08 14:40 cy583 阅读(172) 评论(0) 推荐(0) 编辑
摘要: file1=open('test.txt','w+') #覆盖原有内容写入,指针处于文件开头(打开一个文件用于读写。如果文件存在,删除重新编辑,否则新建写入) file1.write('test1') #在打开的test.txt中写入test1内容 file1.close() #关闭文件file1, 阅读全文
posted @ 2020-07-08 09:12 cy583 阅读(165) 评论(0) 推荐(0) 编辑