报错:
psycopg2.DataError: invalid input syntax for integer: .......LINE 1: ... title,content,nid from newslist_v2 where nid in ('(5663445,..
2.
<pre name="code" class="python">sql = "select title,content,nid from newslist_v2 where nid in (%s)" conn, cursor = get_postgredb() cursor.execute(sql, (ads_str)) 或
sql = "select title,content,nid from newslist_v2 where nid in (%s)" conn, cursor = get_postgredb() cursor.execute(sql, ads_str)
报错:
TypeError: not all arguments converted during string formatting
3. ok的方法:
sql = "select title,content,nid from newslist_v2 where nid in {0}" conn, cursor = get_postgredb() cursor.execute(sql.format(ads_str))
