@staticmethod
def attachments(post):
atts = post['response'][1]['attachments']
att = ''
i = 0
while i <= len(atts)-1:
if atts[i]['type'] == 'photo':
att = att + atts[i]['type'] + atts[i][atts[i]['type']][i]['type']['owner_id'] + '_' + atts[i][atts[i]['type']]['pid'] + ','
if atts[i]['type'] == 'audio':
att = att + atts[i]['type'] + atts[i][atts[i]['type']][i]['type']['owner_id'] + '_' + atts[i][atts[i]['type']]['aid'] + ','
i = i + 1
return att
Получаю странную ошибку
File "main.py", line 53, in attachments
att = att + atts[i]['type'] + atts[i][atts[i]['type']][i]['type']['owner_id'] + '_' + atts[i][atts[i]['type']]['pid'] + ','
KeyError: 0
В чем проблема?