0
데이터베이스 sqlite3를 : 파이썬 내가 아래에있는 내 코드와 작은 프로그램을 가지고
def get_code(hex_pattern, database='./AndroidLockScreenRainbow.sqlite'):
try:
if os.path.exists(database):
with lite.connect(database) as db:
with db.cursor() as c:
c.execute("SELECT * FROM RainbowTable")
rows = c.fetchall()
for row in rows:
if row[0] == hex_pattern:
return row[1]
else:
raise lite.OperationalError("Database file not exists")
except lite.OperationalError:
print('Given SQL table not found!')
코드는 프로그램이 다음과 같은 오류
에게 제공 :, C로) db.cursor (와 라인에 도달with db.cursor() as c: AttributeError: __exit__
무엇이 잘못 되었나요?
커서가 컨텍스트 관리자를 지원하지 않습니다. 당신은 그것과 함께'with'를 사용할 수 없습니다. –