How to fix TypeError: 'str' object doesn't support item deletion in Python | DevErrors