jeudi 9 juillet 2015

Python API SQLite3

Iam using python 2.7 to develop.

I wanted to create a table in SQLite DB, using variables.

But for some reason i cannot achieve something like this for python 2.7:

(This works in python 3.4)

c.execute('CREATE TABLE {tn} ({nf} {ft})'\
        .format(tn=table_name1, nf=new_field, ft=field_type))

How can i create this statement in python 2.7?

I have read a the documentation and other documents but for some reason can t find the correct syntax

Thank you

Aucun commentaire:

Enregistrer un commentaire