Differences between revisions 2 and 3
Revision 2 as of 2006-04-25 05:24:10
Size: 151
Editor: Ericzhao82
Comment:
Revision 3 as of 2006-04-25 06:55:54
Size: 872
Editor: Ericzhao82
Comment:
Deletions are marked like this. Additions are marked like this.
Line 4: Line 4:
import OS 模块
getcwd() //可以获取当前工作目录的路径
chdir('目录路径') //切换工作目录
chdir(os.pardir) //回到上级目录
makedirs //用来创建目录
open('文件名') //打开文件
write('要写入的内容') //
close() //关闭文件,退出
remove('文件名') //删除文件
removedirs('目录名') //删除空目录,空的!
import shutil //引入shutil模块
shutil.rmtree //删除目录,非空目录照样删除
#Using the os Module to Get Information About a File
#使用OS模块获取文件信息
#Using the os Module to Change a File's Privileges and Timestamps
# 使用OS模块改版文件的权限和时间戳
Line 9: Line 25:
 [:CategoryHomepage:Ericzhao]  . [:CategoryHomepage:Ericzhao]

Ericzhao 's Page

import OS 模块 getcwd() //可以获取当前工作目录的路径 chdir('目录路径') //切换工作目录 chdir(os.pardir) //回到上级目录 makedirs //用来创建目录 open('文件名') //打开文件 write('要写入的内容') // close() //关闭文件,退出 remove('文件名') //删除文件 removedirs('目录名') //删除空目录,空的! import shutil //引入shutil模块 shutil.rmtree //删除目录,非空目录照样删除 #Using the os Module to Get Information About a File #使用OS模块获取文件信息 #Using the os Module to Change a File's Privileges and Timestamps # 使用OS模块改版文件的权限和时间戳 Email: MailTo([email protected])

...


  • [:CategoryHomepage:Ericzhao]

Ericzhao82 (last edited 2009-12-25 07:17:38 by localhost)