Apr-22-2020, 10:30 AM
(Apr-22-2020, 10:14 AM)constantin01 Wrote: There are a few strings in a list. But it is interesting, why I can print it without any problems.Because if element is a string, you cannot access it like with dict key, you can use int indexes though:
>>> element = 'some string' >>> element['sentencies'] Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: string indices must be integers >>> element[0] 's' >>> element[3:] 'e string' >>>
(Apr-22-2020, 10:13 AM)TomToad Wrote: data is the dictionary.Nope, data is list, but as it turns out elements are of mixed type - dicts and strings
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs