tags:

views:

68

answers:

3
import sqlite3

conn = sqlite3.connect(r"D:\aaa.db")

Is there a way to automatically create the db file if it doesn't already exist when I connect to it?

thanks

+1  A: 

The code you give does create 'D:\\aaa.db' if it doesn't exist.

Alex Martelli
+1  A: 

Pretty sure .connect will create the file if it doesn't exist.

ongle
A: 

If it isn't created automatically, make sure that you have the directory permissions correct

gnibbler