Python 的 cx_Oracle 模块

导入 cx_Oracle 模块 1 import cx_Oracle # 导入模块 连接数据库 1 2 3 db = cx_Oracle.connect('user', 'password', 'host:port/SID') #建立连接,3个参数分开写 print db.version ##输出 10.2.0.1.0 测试成功 自动提交 1 2 db.autocommit=True #开启自动提交 db.autocommit=False #关闭自动

CentOS 安装官方编译的 Mariadb 10.1 二进制通用包

环境 centos 5.4/6.2/6.5/7.2 x86_64 安装 下载官方编译好的 linux 通用安装包,解压之自定义目录(如/opt)下 1 2 3 4 5 6 7 # rhel 7 地址: wget https://mirrors.tuna.tsinghua.edu.cn/mariadb//mariadb-10.1.19/bintar-linux-glibc_214-x86_64/mariadb-10.1.19-linux-glibc_214-x86_64.tar.gz # rhel 5/6 地址: wget https://mirrors.tuna.tsinghua.edu.cn/mariadb//mariadb-10.1.19/bintar-linux-x86_64/mariadb-10.1.19-linux-x86_64.tar.gz tar zxf mariadb-10.1.19-linux*-x86_64.tar.gz -C /opt/ cd /opt mv mariadb-10.1.19-linux*

Python 的 re 模块

match 定义 1 re.match(pattern, string, flags) 尝试从字符串的开始匹配一个模式 第一个参数是正则表达式,如果匹配成功,则返回一个Match,否则返回一个None; 第二个参数表示

Python 的 time 模块

时间戳: 相对1970.1.1 00:00:00计算的秒数 struct_time: year(2015) month(1-12) day(1-31) hours(0-23) minutes(0-59) seconds(0-59) weekday(0-6,Monday is 0) julian day(day in the year,1-366) DST flag(-1,0,1) time.asctime([tuple]) #把struct_time 转成字符串 time.clock() #第一次调用

Ftp 笔记

环境 CentOS7 vsftpd 关闭 selinux 安装 vsftpd 服务 1 yum install vsftpd 常用客户端 ftp lftp curl 主动模式 建立控制命令连接 客户端连接服务端 21 号端口 建立数据传送连接 客户端在本地监听一个端口(大

Python 的 optionparser 模块

生成标准的、符合Unix/Posix 规范的命令行说明 1 2 3 4 5 6 7 8 9 10 11 from optparse import OptionParser parser = OptionParser() parser.add_option('-p', '--pdbk', action = 'store_true', dest = 'pdcl', default = False, help = 'write pdbk data to oracle db') parser.add_option('-z', '--zdbk', action = 'store_true', dest =

Python 的 os 和 os.path

os.getcwd() #返回运行脚本的目录 os.listdir() #获取目录中的内容 os.path.basename() #去掉目录路径,返回文件名 os.path.dirname() #去掉文件名,返回目录路径 os.path.join() #组合成合法路径 os.path.split() #返回路径和文件名元组

Python 调用 Shell 命令

os 阻塞,返回shell执行参数命令的状态,即成功返回0 1 os.system('cat /proc/cpuinfo') 阻塞,返回file read的对象,对该对象进行 read() 可以获取shell执行参数命令的

Grub 笔记

启动 archlinux 镜像 64位系统 1 2 3 4 5 6 7 menuentry "Archlinux-ISO-x86-64" --class iso { set isofile="" set partition="" loopback loop (hd0,$partition)$isofile linux (loop)/arch/boot/x86_64/vmlinuz archisolabel=ARCH_ISO_X86-64 img_dev=/dev/sda$partition img_loop=$isofile earlymodules=loop initrd (loop)/arch/boot/x86_64/archiso.img } 启动 archlinux 镜像 32位系统 1 2 3 4 5 6 7 menuentry "Archlinux-ISO-i686" --class iso { set isofile="" set partition="2" loopback loop (hd0,$partition)$isofile linux (loop)/arch/boot/i686/vmlinuz archisolabel=ARCH_ISO_I686