root@cacti:~/box# cat convert.py #!/usr/bin/env python import sqlite3,time,rrdtool,os def boxstatus(): ''' check the status of the box, and set it to 1 if it is online, set it to 0 if it is offline ''' if "status.db": os.system('rm status.db') d
昨天晚上封装了configparser模块,是根据keyname获取的value.python封装configparser模块获取conf.ini值 我原本是想通过config.ini文件中的section和keyname获取value的,前两天怎么都调试不通过.今天百度了一下,有人通过字典的方式把我的和这个想法实现了,我把这个例子修改了一下,代码如下,并通过测试,以后可以用在自动化测试框架中: #coding:utf-8 import os import ConfigParser class
官方文档:https://docs.python.org/2/library/sqlite3.html sqlite教程:http://www.runoob.com/sqlite/sqlite-delete.html 安装: linux系统一般自带sqlite不需安装.在终端输入sqlite3,出现如下提示则表示已经安装了sqlite SQLite version 3.6.20 Enter ".help" for instructions Enter SQL statements te