Возникает ошибка IndexError: list index out of range при обращении к res[1]
out
['2999', '3299']
['3199']
['3299']
['3699']
['3699']
['3999', '4499']
['4299', '4599']
listPrices = []
testList = [['2999', '3299'], ['2899']]
#testList = [['2999', '3299'], ['2899', None]]
"""
listPrices = []
testList = [['2999', '3299'], ['2899']]
for res in testList:
if res[1] is not None:
listPrices = [res[0], res[1]]
else:
listPrices = [res[0], None]
print(listPrices)
"""
for res in testList:
print(res[1])
Сделать список так не удается(
['2999', '3299']
['3199', None]
['3299'', None]
['3699'', None]
['3699'', None]
['3999', '4499']
['4299', '4599']