Python + SQLite check | HELP
I'd like to check if name I set in Python is in SQLite table > Column. How to make it? Example: name = 'John' Table name: Table_name column name: Name Which function should I use? Please help!
i guess first thing is to insert a name o_O check = c.execute('INSERT into Table_name VALUES (?)', 'John')
and then: name="John" check = c.execute("SELECT name from Table_name WHERE name="+name)
might be for the best SQL ain't my strong suite xD
have you checked the API? https://docs.python.org/3/library/sqlite3.html
can you post any code you have so far?
and do you have anything in the table? sorry my SQL is rusty xD http://sebastianraschka.com/Articles/2014_sqlite_in_python_tutorial.html some nice info here
according to the link i posted: "if we use the .fetchall() method, we return a list of tuples from the database query, where each tuple represents one row entry. " so it shouldn't be an issue that it displays [(0,)] instead of 0
So, how to pair it with Python? How to check if name is in table?
Yes, checked. But can't find the right function
c = conn.cursor() name = 'John' check = c.execute('SELECT count(name) FROM table_name') c.fetchall() >>> ([0,]) I need at least 0 instead of ([0,])
No, didn't help. Still the output is [(0,)] instead of 0
I'll check this site
What is the best coding language
YouTube Link Finder