본문으로 바로가기

DB Parser

category Coding/Python 2015. 12. 25. 02:59
반응형

import MySQLdb


db = MySQLdb.connect(db='', user='root', passwd='', host='localhost', charset='euckr', use_unicode=True) // 한글깨짐 해결

cursor = db.cursor()

cursor.execute('SELECT * FROM table')

recs = cursor.fetchall()

f = open("auth.log", 'w')

for rec in recs:

    result = '[no] = %d\n'%(rec[0])

    f.write(result.encode("utf-8"))

     

f.close()

cursor.close()



반응형

'Coding > Python' 카테고리의 다른 글

소켓 통신할때 Response 못받아오는 문제  (0) 2016.01.08
Selenium 경로설정  (0) 2016.01.08
정렬 알고리즘  (0) 2015.03.09
파이썬 소켓 프로그래밍  (0) 2014.08.13
Python Blind,Time Based SQL Injection Source  (0) 2014.06.15