Is there an easy way to control indents in Python
Ian Kelly
ian.g.kelly at gmail.com
Mon Oct 20 15:40:47 EDT 2014
On Mon, Oct 20, 2014 at 1:04 PM, Juan Christian
<juan0christian at gmail.com> wrote:
> Ok, new code using ?:
I suspect you meant to post this to some other thread.
> def get_db(_id):
> cursor = db.execute("SELECT ID, URL, AUTHOR, MESSAGE FROM TOPICS WHERE ID =
> ?", (_id))
> return cursor.fetchone()
(_id) is not a tuple; it's just a parenthesized variable name. To
create a one-element tuple you need a trailing comma: (_id,)
Remember that with the exception of the empty tuple (), tuples are
created by commas, not parentheses.
More information about the Python-list
mailing list