i have a simple database query by psycopg2 but i do not know why it always show errors here is the code
ip ="127.0.0.1"
sql="select count(*) from radacct where nasipaddress=%s"
cur.execute(sql,ip)
then it will show
TypeError: not all arguments converted during string formatting
and if i try in this way
cur.execute("select count(*) from radacct where nasipaddress=%s" % ip)
it is still not working
how can i pass the parameters to psycopg2 in the correct way.please help me!