python - Creating database file one directory above current -
in php, refer higher directory use '../../test'; how in python?
in case, i'm using sqlite create database file.
import sqlite3 conn = sqlite3.connect('../data/test.db')
however; says 'unable open database file' i'm considering directory access error. how refer higher directory in python?
you might try this:
conn = sqlite3.connect(os.path.realpath('../data/test.db'))
Comments
Post a Comment