Код: Выделить всё
def c(x):
conn = psycopg2.connect(dbname = NAME, user = USER, password = PASSWORD, host = HOST, port=PORT)
cur = conn.cursor()
sql = """SELECT * from course where cid ilike '{code}'"""
new = sql.format(code=x)
cur.execute(new)
y = (cur.fetchone()) # I also tried fetchall()
cur.close()
print(y)
#you = [list(i) for i in y]
return y
if __name__=="__main__":
c('CSC42184')
print(c)
('CSC42184', 'BLAH', 'BLAH I want to manipulate this') #from the print statement in the function
Подробнее здесь: https://stackoverflow.com/questions/533 ... ow-to-retu
Мобильная версия