-
11 年前
Python 运维开发 学习记录 语言基础(四)
Shell/Python 装饰器 面向对象 静态类
一、装饰器 作用就是在函数调用方法不变的情况下,把此函数包装成另一个函数来使用 def auth(func): def wrapper(*args,**kwargs): user = raw_input("input_passwd: ") if user == 'admin': print "welcome login."…
-
11 年前
Python 运维开发 学习记录 语言基础(五)
Shell/Python socket MySQLdb
一、Python MySQL交互 常用函数 commit() 提交 rollback() 回滚 cursor 用来执行命令的方法: callproc(self, procname, args) 用来执行存储过程,接收的参数为存储过程名和参数列表,返回值为受影响的行数 execute(self, query, args…