I'm using a dictionary to compile data about stocks and such but when I come to reference the gtin code input by the user, i get the error 'List indices must be integers or slices, not str - Python'
This is the only section of code that causes this:
tempStockLvl = [num]['STOCK_LEVEL'] # This is the line the error references
tempStockLvl = int(tempStockLvl)
tempStockLvl = tempStockLvl - quantity
stock[num]['STOCK_LEVEL'] = tempStockLvl
Error:
File "E:\Computer Science\CODE FINAL v2.py", line 206, in subtractQuant
tempStockLvl = [num]['STOCK_LEVEL']
TypeError: list indices must be integers or slices, not str
Thanks in advance to anyone who answers :D