I try to execute INSERT in a DB:
import psycopg2 import pprint import sys def main(): caden = "host='localhost' dbname='my' user='postgres' password='postgrespass'" print(caden) obj = psycopg2.connect(caden) objCursor = obj.cursor() objCursor.execute("INSERT INTO _reference10( _idrref, _version, _marked, _predefinedid, _code, _description) VALUES(%s,%s,%s,%s,%s,%s)", ("\275\233\000\023waU\236\021\345\343\271\273\226\304\366",0 ,false ,"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" , "000000014", "Brazil14")) obj.commit() objCursor.execute("SELECT * FROM _reference10;") registr1=objCursor.fetchall() print(regist1) objCursor.close() obj.close() if __name__ =='__main__': main()
But an exception occurs:
File "C: \ Python \ Projects \ p.py", line 18 objCursor.execute ("INSERT INTO _reference10 (_idrref, _version, _marked,> _predefinedid, _code, _description) VALUES (% s,% s,% s,% s,% s,% s) ", (" \ 275 \ 233 \ 000 \ 023waU \ 236 \ 021 \ 345 \ 343 \ 271 \ 273 \ 226 \ 304 \ 366 ", 0, false," \ 000 \ 000 \ 000 \ 000 \ 000 \ 000 \ 000 \ 000 \ 000 \ 000 \ 000 \ 000 \ 000 \ 000 \ 000 \ 000 "," 000000014 "," Brazil14 ")) ^ IndentationError: unexpected indent [Finished in 0.1s]
What could be the error?