import os import time import sys from xml.dom import minidom, Node from xml.dom.minidom import parse,parseString from stat import * import xml.etree.ElementTree as ET #删除1day前的日志 def DelLog(filepath): if not os.path.isdir(filepath) and not os.path.is
import java.io.File; public class Test { public static void main(String args[]){ Test t = new Test(); delFolder("c:/bb"); System.out.println("deleted"); } //删除文件夹 //param folderPath 文件夹完整绝对路径 public static void delFolder(String folderP
#!/usr/bin/env python import osimport sys def read_file(fpath): Block_Size = 1024 with open(fpath,"r") as f: while True: block = f.read(Block_Size) if block: yield block else: return for i in read_file(sys.argv[1]): print(i)
python版本为:2.7 import os,time,shutil,datetime def rmdir(deldir,N): dellist=os.listdir(deldir) deldate= datetime.timedelta(days=N) now = datetime.datetime.now() for i in dellist: os.chdir(deldir) ctime = datetime.datetime.fromtimestamp(os.path.getctime
import os import time import datetime def should_remove(path, pattern, days): if not path.endswith(pattern): return False mtime = os.path.getmtime(path) now = time.time() result = now - mtime > days * 24 * 3600 print "\n>>>>>>>
由数据库导出的数据是格式化数据,如下所示,每两个<REC>之间的数据是一个记录的所有字段数据,如<TITLE>.<ABSTRACT>.<SUBJECT_CODE>.但是每条记录中可能某些字段信息为空, 在导出的文本文件中,就会缺失这个字段,如记录3,缺失<ABSTRACT>这个字段,记录4,缺失<SUBJECT_CODE>这个字段. <REC>(记录1) <TITLE>=Regulation of the pr