파이썬 mysql 로그 삽입
pymysql 을 이용한 mysql db로그 삽입하기. import pymysql conn = pymysql.connect(host='localhost', user='hello_mysql', password='1', db='logs', charset='utf8') curs = conn.cursor() sql = "insert into access_log(ip, access_time, method, uri, status)\ values (%s,%s, %s, %s,%s)" logfile_path = '/경로/' logfile_fullpath = logfile_path + '파일이름' count = 0 with open(logfile_fullpath, 'r') as f: for line in f: count ..
2020. 8. 25.