码迷,mamicode.com
首页 >  
搜索关键字:listdir    ( 526个结果
python常用模块
********************PY核心模块方法********************os模块: os.remove() 删除文件 os.unlink() 删除文件 os.rename() 重命名文件 os.listdir() 列出指定目录下所有文件 os.chdir() 改变当前工作目录 ...
分类:编程语言   时间:2016-11-16 02:19:31    阅读次数:221
如何得到目录下的所有文件
(1)通过os模块的listdir方法 (2)通过os模块的walk方法 (3)利用glob模块进行匹配搜索 ...
分类:其他好文   时间:2016-10-16 21:50:44    阅读次数:225
python的os模块
1.得到当前工作目录,即当前Python脚本工作的目录路径: os.getcwd() 2.返回指定目录下的所有文件和目录名:os.listdir() 3.函数用来删除一个文件:os.remove() 4.删除多个目录:os.removedirs(r"c:\python") 5.创建目录:os.mkd ...
分类:编程语言   时间:2016-10-02 15:02:39    阅读次数:166
Python学习日志(一)
1.os - Normal Method: os.name() : os.getcwd(): 给出当前的目录,python当前的工作目录 os.listdir(): 返回 os.remove():删除 os.system(): 来到shell os.sep: 取代操作系统特定路径分隔符 os.lin ...
分类:编程语言   时间:2016-09-23 06:36:55    阅读次数:169
python根据文件更改日期删除指定文件夹下面文件
经过一天的尝试,终于写了一个脚本,清理日志文件,源代码如下:#!/usr/bin/python#-*-coding=utf8-*-importtimeimportosN=1#设置删除多少天钱的文件defdeletefile(path):foreachfileinos.listdir(path):filename=os.path.join(path,eachfile)ifos.path.isfile(filename):lastm..
分类:编程语言   时间:2016-09-02 01:12:18    阅读次数:291
批量该文件名
#!/usr/bin/pythonimport ospath1='/root/model/'file=os.listdir(path1)num=file.index('index.html')del file[num]c=str(file)c=c.replace('_','.')c=c.title( ...
分类:其他好文   时间:2016-08-31 15:21:26    阅读次数:185
goLang文件遍历
package main import ( "fmt" "io/ioutil" "os" "path/filepath" "strings" ) //获取指定目录下的所有文件,不进入下一级目录搜索,可以匹配后缀过滤。 func ListDir(dirPth string, suffix string ...
分类:其他好文   时间:2016-08-26 12:11:42    阅读次数:589
1、python之文件部分
python中对文件、文件夹(文件操作函数)的操作需要涉及到os模块和shutil模块。具体知识点如下: 得到当前工作目录,即当前Python脚本工作的目录路径: os.getcwd() 返回指定目录下的所有文件和目录名:os.listdir() 函数用来删除一个文件:os.remove() 删除多 ...
分类:编程语言   时间:2016-08-16 13:02:06    阅读次数:203
Python 学习笔记(Machine Learning In Action)K-近邻算法识别手写数字
1 from numpy import * 2 import matplotlib 3 from os import listdir 4 import kNN 5 def img2vector(filename): 6 returnVect = zeros((1,1024)) 7 fr = open ...
分类:编程语言   时间:2016-08-12 21:22:23    阅读次数:587
以写代学:python os模块 cpickle模块
>>>importtab >>>importos >>>os.symlink("a.txt","aa.txt")//创建a.txt的链接文件aa.txt >>>os.listdir(os.curdir)//查看当前目录 >>>os.listdir(os.pardir)//查看父目录(上级目录) >>>os.listdir(".")//查看当前目..
分类:编程语言   时间:2016-08-03 15:36:40    阅读次数:348
526条   上一页 1 ... 39 40 41 42 43 ... 53 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!