import psycopg2 def djselect(): connection = psycopg2.connect(host='localhost', dbname='dbdata', user='postgres', password='Q1w2e3r4') cursor = connection.cursor() cursor.execute('''SELECT * FROM public.food''') arr = list(cursor.fetchall()) res = '' k = 0 while k != len(arr): i = arr[k] res = res + f'''

{i[1]}

{i[2]}

''' k += 1 cursor.close() connection.close() return res