111

#导入相关模块
import MySQLdb
import os
import re
#建立和mysql数据库的连接
conn = MySQLdb.connect(host='localhost',user='root',passwd='123lqh')
conn.select_db('slowquery')
curs = conn.cursor()
file=open("new2.txt")
x=()
j=()
for line in file.xreadlines():
    if 'Count         :' in line:
        m=re.findall(r":(.+)",line)
        print m
    if 'Time          :' in line:
        n=re.findall(r":(.+)",line)
        print n
for x in m :
    for j in n:
        print x+j

~

posted on 2017-09-01 19:04  步行者811  阅读(110)  评论(0)    收藏  举报

导航