python89

 

1 windows 下 根文件夹C:\   附加卷D:\  或E:\      路径分隔符\

Mac  根文件夹/      附加卷/mnt   路径分隔符/

2.查找当前目录

3如何切换当前工作目录

4如何创建新文件夹

5如何将绝对路径修改为相对路径

 

6

7

>>> os.path.getsize('C:\\Windows\\System32\\calc.exe')

 

8

9

helloFile = open('C;\\Users\\your_home_folder\\hello.txt')
baconFile.close()
baconFile=open('bacon.txt,'a')
baconFile.Write('Bacon is not a vegetable.')


10同上

11shelf不必担心如何将程序的数据保存在文件中,不必用读模式或者写模式打开

12

import shutil,os
os.chdir('C:\\')
shutil.copy('C:\\spam.txt','C:\\delicious')


13

import shutil
shutil.move('C:\\bacon.txt','C:\\eggs')


14

import send2trash
baconFile = open('bacon.txt','a')# creates the file
baconFile.write('Bacon is not a vegetable.')

15 16 17正在研究中。。。。。

 

posted @ 2019-06-05 21:30  何奈琉璃  阅读(160)  评论(0编辑  收藏  举报