import sys from sqlite3 import dbapi2 as sqlite # connect to the database dbname = 'app.db' conn = sqlite.connect(dbname) conn.execute('create table if not exists list(text);') # read the input text = ' '.join(sys.argv[1:]) print text # put the input in the database query = "insert into list values (?)" conn.execute(query, "hello world") # close the database