cur.execute('insert into keywords(keywords, count) values(%s,%s)', (key, from_url_dict[key]))
{key1:10,key2:100}
{key1:30,key3:100}
前面是key,對應的後面是count
如何讓mysql插入資料的時候當有key相同時,對應的count數值就相加?
迷茫2017-05-16 13:11:32
insert into keywords(keywords, count) values(%s,%s) ON DUPLICATE KEY UPDATE count = count +1;