压缩.log 文件为zip后删除原文件 需要注意:本人作为小白,该脚本需要和.log在一起,后面有时间需要改正. #!/usr/local/python/bin/python #-*-coding=utf8 -*- import time import os import sys import zipfile N = 7 #设置删除多少天前的文件 def zip(srcpath): for folder,sumfolder,files in os.walk(srcpath): for file
[习题] 指定一个源文件,实现copy到目标目录.例如把/tmp/sample1.txt 拷贝到/tmp/sample2.txt原文件需要有读权限(默认rt权限),目标文件需要给写(w即可)权限. In [8]: with open('/tmp/sample1.txt',encoding='UTF-8') as f1: ...: with open('/tmp/sample2.txt','w',encoding='utf-8') as f2: ...: content = f1.read() .
目录:[Swift]Xcode实际操作 本文将演示如何复制.移动和删除文件. 在项目导航区,打开视图控制器的代码文件[ViewController.swift] import UIKit class ViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view, typically from
目录:[Swift]Xcode实际操作 本文将演示如何遍历文件夹下的内容. 在项目导航区,打开视图控制器的代码文件[ViewController.swift] import UIKit class ViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view, typically from
目录:[Swift]Xcode实际操作 本文将演示如何创建文件夹. 在项目导航区,打开视图控制器的代码文件[ViewController.swift] import UIKit class ViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view, typically from a ni