小白学python
来源:互联网 发布:影视vip软件下载 编辑:程序博客网 时间:2024/06/05 15:15
简明python教程中:我想要一个可以为我的所有重要文件创建备份的程序。这个由于原作者是使用linux写的,所以zip—command在Windows系统下面会报错。在用info-zip和7zip无果的情况下,试了一下winrar命令,最后居然成功了。程序如下:
#!/usr/bin/python
#Filename:backup_verl.py
import os
import time
#The files and directories to be backed up are specified in a list
source=[r'E:\ds',r'F:\py123']
#The back up must be stored in a main backup directory
target_dir='/m n t/e/backup/' #Remember to change this to what you will be using
#The files are backed up into a zip file
#The name of the zip archive is the current date and time
target=target_dir+time.strftime('%Y%m%d%H%M%S')+'.zip'
#sue the winrar command to put the files in a zip archive
WinRaR_command="WinRaR a {0} {1}".format(target,source)
#Run the backup
if os.system (WinRaR_command)==0:
print'Sucessful back up to',target
else:
print'Bcakup FAILED'
程序具体情况明天分析,朋友叫我跑步啦。遇到问题不要放弃,问题是用来解决而不是遗忘的。
- 小白学python
- 小白学python
- Python小白学Twisted
- 小白学python爬虫
- 小白学python(8.14)
- 小白学Python自定义函数
- 小白学python level1
- Python
- Python
- Python
- python
- Python
- PYTHON
- Python
- Python
- Python
- Python
- Python
- 用bootstrap实现包含下拉列表、输入框、按钮的组合框
- mysql-5.7.17-winx64 解压版 下载安装
- python 列表
- 算法训练 特殊的数字四十
- saltstack-本地安装rpm方式
- 小白学python
- 支付宝接口原理和流程 使用TP框架
- Python串口模块pySerial
- oj3096: 老王的鱼塘
- java学习日志(二)-- 循环Loop实验
- 源码安装Git2.12.0
- Foundation of Machine Learning 笔记第一部分——PAC学习框架
- 《Effective C++》要点摘录
- python学习之argparse模块