Postgres Find String Method In Python For Loops