일부 조건에 따라 사전의 값을 변경하고 싶습니다.목록의 요소에 값 목록을 할당하는 방법
mydic = {"10": [1, 2, 3], "20": [2, 3, 4, 7]}
key = mydic.keys()
val = mydic.values()
aa = [None] * len(key)
for i in range(len(key)):
for j in range(len(val[i])):
if val[i][j] <= 5:
aa[i][j] = int(math.ceil(val[i][j]/10))
else:
aa[i][j] = "f"
오류 :
TypeError: 'NoneType' object does not support item assignment
정말 감사합니다! – Franco