1
에 나는이 포함 된 인덱스가 있지만 :KeyError를 확실히 사전
IRD\0.jpg [ 4.64939594e-01 6.48846030e-02 2.00261129e-04 0.00000000e+00 0.00000000e+00 ... 7.34290807e-04 6.90233335e-02 2.02463999e-01]
을하지만, 여기에 전화했을 때 :
for (k, hist) in index.items():
# compute the distance between the two histograms
# using the method and update the results dictionary
d = method(index['IRD\0.jpg'], hist)
results[k] = d
는이 오류와 함께 제공 :
KeyError Traceback (most recent call last)
<ipython-input-98-b7c782484164> in <module>()
# compute the distance between the two histograms
# using the method and update the results dictionary
d = method(index['IRD\0.jpg'], hist)
results[k] = d
을 왜 그런지 모르겠다. 도움을 많이 주시면 감사하겠습니다. 분명한 사실을 알지 못해서 미안하지만 매우 익숙합니다.
길이 2의 튜플 실제로리스트'index'되는
index['IRD\0.jpg']
을 변경, 네가 시사하는 바대로? – Anonymous파이썬이 "혼란 스럽거나"키가 깨닫지 못하는 것처럼 보이지 않습니다. 핵심 오류가 발생하면 잘못된 결과가 발생합니다. 루프에서'index'의 모든 키를 인쇄하면 – Anonymous
@jphollowed 색인에 키 (파일 이름)가 포함되어 있고 값은 픽셀 값이됩니다. – ExJasmine