Skip to content

Commit 08aa514

Browse files
author
wangxiaoxian
committed
clean code
1 parent 8e4df98 commit 08aa514

File tree

1 file changed

+0
-19
lines changed

1 file changed

+0
-19
lines changed

AK-wang/0002/save_key.py

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -63,40 +63,21 @@ def process():
6363
QueryData(conn)
6464
dbconn.close()
6565

66-
#def execute(sql):
67-
# '''执行sql'''
68-
# conn=dbconn.cursor()
69-
# conn.execute(sql)
70-
71-
#def executemany(sql, tmp):
72-
# '''插入多条数据'''
73-
# conn=dbconn.cursor()
74-
# conn.executemany(sql,tmp)
75-
7666
def query(sql,conn):
77-
'''查询sql'''
78-
#conn=dbconn.cursor()
7967
conn.execute(sql)
8068
rows = conn.fetchall()
8169
return rows
8270

8371
def DropTable(conn):
84-
#conn=dbconn.cursor()
8572
conn.execute("DROP TABLE IF EXISTS `user_key`")
8673

8774
def CreateTable(conn):
88-
#conn=dbconn.cursor()
8975
sql_create =''' CREATE TABLE `user_key` (`key` varchar(50) NOT NULL)'''
9076
conn.execute(sql_create)
9177

9278
def InsertDatas(conn):
93-
#conn=dbconn.cursor()
94-
#insert_sql = "insert into user_key values(%s)"
9579
insert_sql = "INSERT INTO user_key VALUES (%(value)s)"
9680
key_list = key_num(KEY_ALL)
97-
#print len(key_list)
98-
#conn.executemany(insert_sql,str(key_listi))
99-
#conn.executemany("INSERT INTO user_key VALUES (%(value)s)",[dict(value=v) for v in key_list])
10081
conn.executemany(insert_sql,[dict(value=v) for v in key_list])
10182

10283
def DeleteData():

0 commit comments

Comments
 (0)