Python组装 update
时间:2010-07-19 来源:lvmingyan
只留自用
import LVDataBase db = LVDataBase.LVDataBase() res = db.doquery_dic("select * from action_inf") sql = '' for i in res: flag_str = 'update action_inf set ' 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
相关阅读 更多 +