python - How to create or open a database with a value stored in a variable -
i'm using sqlite store values in database , values different source have put them in different database tried like:
source_name = "hello" ext = ".db" path = "d:/" fullpath = path + source_name + ext db = sqlite3.connect("%s") % (fullpath) but didn't work, solutions or ideas.
the error reported :
%s within quotes :
typeerror: unsupported operand type(s) %: 'sqlite3.connection' , 'str' %s without quotes :
syntaxerror: invalid syntax
str.__mod__() method on str:
db = sqlite3.connect("%s" % fullpath) or because fullpath string:
db = sqlite3.connect(fullpath)
Comments
Post a Comment