So I would like to make a Python dictionary with the elements of one list as the keys and the list elements of another list as the values, is this possible?
So that:
list1 = ('red', 'blue', 'green', many more strings )
list2 = (1, 2, 3, many more values)
d = { list1[0:]: list2[0:] }
This obviously does not work, but something similar?
You can do it like that:
>>> d = dict(zip(list1, list2))
{'blue': 2, 'green': 3, 'red': 1}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With