You can try this way :
list1=[['in', 'comparison', 'to', 'dogs', ',', 'cats', 'have', 'not', 'undergone', 'major', 'changes', 'during', 'the', 'domestication', 'process', '.'], ['as', 'cat', 'simply', 'catenates', 'streams', 'of', 'bytes', ',', 'it', 'can', 'be', 'also', 'used', 'to', 'concatenate', 'binary', 'files', ',', 'where', 'it', 'will', 'just', 'concatenate', 'sequence', 'of', 'bytes', '.'], ['a', 'common', 'interactive', 'use', 'of', 'cat', 'for', 'a', 'single', 'file', 'is', 'to', 'output', 'the', 'content', 'of', 'a', 'file', 'to', 'standard', 'output', '.'], ['cats', 'can', 'hear', 'sounds', 'too', 'faint', 'or', 'too', 'high', 'in', 'frequency', 'for', 'human', 'ears', ',', 'such', 'as', 'those', 'made', 'by', 'mice', 'and', 'other', 'small', 'animals', '.']]
dict = {v:i for l in list1 for i,v in enumerate(l)}
print(dict)
Output :
{'in': 0, 'comparison': 1, 'to': 2, 'dogs': 3, ',': 4, 'cats': 5, 'have': 6, 'not': 7, 'undergone': 8, 'major': 9, 'changes': 10, 'during': 11, 'the': 12, 'domestication': 13, 'process': 14, '.': 15} {'as': 0, 'cat': 1, 'simply': 2, 'catenates': 3, 'streams': 4, 'of': 24, 'bytes': 25, ',': 17, 'it': 19, 'can': 9, 'be': 10, 'also': 11, 'used': 12, 'to': 13, 'concatenate': 22, 'binary': 15, 'files': 16, 'where': 18, 'will': 20, 'just': 21, 'sequence': 23, '.': 26} {'a': 16, 'common': 1, 'interactive': 2, 'use': 3, 'of': 15, 'cat': 5, 'for': 6, 'single': 8, 'file': 17, 'is': 10, 'to': 18, 'output': 20, 'the': 13, 'content': 14, 'standard': 19, '.': 21} {'cats': 0, 'can': 1, 'hear': 2, 'sounds': 3, 'too': 7, 'faint': 5, 'or': 6, 'high': 8, 'in': 9, 'frequency': 10, 'for': 11, 'human': 12, 'ears': 13, ',': 14, 'such': 15, 'as': 16, 'those': 17, 'made': 18, 'by': 19, 'mice': 20, 'and': 21, 'other': 22, 'small': 23, 'animals': 24, '.': 25}
2
solved I have some list of lists. I need to make a dictionary from it.Examples below [closed]