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
How do I generate a list with <N> unique elements randomly selected from another (already existing) list?
Given three integer matrices A(m*n),B(m*n) and C(m*n) . Print the one with more zero elements. beside code
I'm coding this for hours & can't make the value of the 5 random numbers round off to 2 decimal places like in the examples
Overloading + operator