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正在研究中。。。。。

 

转载于:https://www.cnblogs.com/hanai--/p/10982048.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值