这是我的代码......我得到
.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)
有任何想法吗?