python os 模块
Python 3 教程二:文件,目录和路径
http://www.cnitblog.com/yunshichen/archive/2009/04/01/55931.html
python os模块
http://hi.baidu.com/happynp/blog/item/729243f902d5a751242df2c2.html
http://hi.baidu.com/fiber212121/blog/item/6e07ec03c97b6982d53f7c27.html
python getopt模块
http://www.tsnc.edu.cn/default/tsnc_wgrj/doc/pythonhtml/html/scripts_and_streams/command_line_arguments.html
http://www.sqlite.com.cn/MySqlite/11/416.Html
http://docs.python.org/library/getopt.html
http://docs.python.org/library/optparse.html
mysqldbback.py
#!/usr/bin/python
import os
import time
import ftplib
import traceback
#config vars
systempathchr="/" #路径分割符,*nix用"/" win32用"\\"
dbuser="root" #数据库用户名
dbpwd="dbpwd" #数据库密码
dbnamelist=["dbone","dbtwo","dbthree"] #需要备份那些数据库
workdir="/path/to/backup/" #本地备份文件夹
errlogfile="databack.log" #错误日志名
ftp_addr="192.168.0.2" #ftp地址
ftp_port="2102" #ftp端口
ftp_user="databack" #ftp用户名
ftp_pwd="backpwd" #ftp密码
ftp_path="/" #存放到ftp路径
ftpqueue=[]
def ftpstor():
#login
bufsize=1024
ftp=ftplib.FTP()
try:
ftp.connect(ftp_addr,ftp_port)
ftp.login(ftp_user,ftp_pwd)
ftp.cwd(ftp_path)
for filepath in ftpqueue:
#open file for input as binary
f=open(filepath,"rb")
#store file as binary
print getfilename(filepath)
ftp.storbinary("STOR "+getfilename(filepath),f,bufsize)
f.close()
ftp.quit()
except:
path=os.path.join(workdir,errlogfile)
traceback.print_exc(file=open(path,"a"))
def dumpdb(dbname):
global ftpqueue
timeformat="%Y%m%d"
sqlvalformat="mysqldump -u%s -p\"%s\" \"%s\" >\"%s
相关文档:
Python是一种面向对象的解释性的计算机程序设计语言,也是一种功能强大而完善的通用型语言,已经具有十多年的发展历史,成熟且稳定。Python 具有脚本语言中最丰富和强大的类库,足以支持绝大多数日常应用。它具有简单、易学、免费、开源、可移植性、解释性、面向对象、可扩展性、可嵌入性以及丰富的库等特性, ......
一般安装的都是Python22版,wincvs1.3需要python2.1版本及以上。但是启动过程找不到,网上搜索的方法不大适用。最后经过试验发现,把Python22安装路径下的python22.dll拷贝到wincvs的安装目录下。运行wincvs,ok。觉得这个方法好用的给顶下! ......
Chapter 1
Python and XML
Python and XML are two very different animals, each with a rich
history. Python is a full-scale programming language that has grown
from scripting world roots in a very organic way, through the vision
and guidance of Python's inventor, Guido van Rossum. Guido continue ......
Python的字典操作
Python提供了多种应用于字典的操作。因为字典为容器,内建len函数可以将字典当作单一参数使用听切返回字典对象中项目(键/值对)的数目。
字典会员
在Python2.2以及后面版本,D中的k运算符检测是否对象k是字典D中的键。如果是返回True如果不是返回False。相似的,
索引一个字典
字典D中的值 ......
http://hbszyandong.javaeye.com/blog/377199
# -*- coding: utf-
8
-*-
from datetime import
datetime
from datetime import
date
from time import
strftime
from time imp ......