sql - 这段代码如何pythonic,数据库查询
PHPz
PHPz 2017-04-18 09:34:51
0
1
270
PHPz
PHPz

学习是最好的投资!

reply all(1)
小葫芦
  • You can try not to spell the SQL statement yourself, but use the functions that come with the system library, such as

results = cur.select(table = 'articles', columns = ['id','link','is_keywords_avaliable'], where = correct_parms) # 具体的参数我也记得不清楚,可以自己查查看。
  • Use format strings to easily replace parameters.

sql = "select {columns} from {table} {is_where} {condition}".format(columns = 'id, link, is_keywords_available', table = 'articles', is_where = "where", condition = ".....")
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template