これが私のコードです...私は得ています
.format(table_name=self._table, condition=row['where']))
NameError: global name 'row' is not defined
コード:
def retrieveSmCityCust(self, key):
cursor = self._db.execute('SELECT CONTRACTS.CUSTOMER_NAME, CONTRACTS.CUSTOMER.CITY, CITIES.POPULATION FROM CONTRACTS JOIN CITIES ON CONTRACTS.CUSTOMER_CITY = CITIES.IDENT where {condition}'.format(table_name=self._table, condition=row['where']))
return dict(cursor.fetchall())
db = database(filename = 'insurance.sqlite')
db.retrieveSmCityCust({'where': 'CITIES.POPULATION <=500000'})
for row in db:
print(row)
何か案は?