ahxcjxzxh 发表于 2017-4-22 10:41:13

Python组装 update


只留自用


import LVDataBase
db = LVDataBase.LVDataBase()
res = db.doquery_dic("select * from action_inf")
sql= ''
for i in res:
flag_str = 'update action_infset '
for key_item, value_item in i.iteritems():
flag_str = flag_str + key_item + ' = ' + "'%s'" %str(value_item) + ','
flag_str = flag_str + ") where action_id = '%s' ;" %i['action_id']
print flag_str
页: [1]
查看完整版本: Python组装 update