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

Popular posts from this blog

html - Styling progress bar with inline style -

java - Oracle Sql developer error: could not install some modules -

How to use autoclose brackets in Jupyter notebook? -