python目录与文件名操作例子
1、操作目录与文件名#!/usr/bin/env python #-*- coding: utf-8 -*- import os,re import shutil import time用listdir搜索def search_OFD_old(my_pattern, diretory): &nbs
巴扎黑 2017-01-16 15:12:13 0 0 350
python 文件操作api
python中对文件、文件夹(文件操作函数)的操作需要涉及到os模块和shutil模块。得到当前工作目录,即当前Python脚本工作的目录路径: os.getcwd()返回指定目录下的所有文件和目录名:os.listdir()函数用来删除一个文件:os.remove()删除多个目录:os.removedirs(r“c:\python”)检验给出的路径是否是一个文件:os.path.isfile()
巴扎黑 2017-01-16 15:08:26 0 0 391