i have same title and same title in row in my db table i want to compare this for finding equality. i try this but not work , any solution ? thank :)
def get_files_to_load(dir):
files_to_load = []
files = os.listdir(dir)
for file in files:
file_full_path = os.path.join(os.path.abspath(dir),file)
with open(file_full_path, 'r', errors='ignore'):
file_to_load = file[:-4]
files_to_load.append(file_to_load)
return files_to_load
files_fullpath = get_files_to_load('./foo/foo/static/media/pdf')
print(files_fullpath)
try:
connection = psycopg2.connect(user="foo",
password="foo",
host="localhost",
database="foo")
cursor = connection.cursor()
postgreSQL_select_Query = "select * from table"
cursor.execute(postgreSQL_select_Query)
print("Selecting rows from actes table using cursor.fetchall")
acte_records = cursor.fetchall()
print("Print each row and it's columns values")
for row in acte_records:
if row[1] == files_fullpath:
print( row[1])
else:
print ('...')