I have a list of strings of the type cities=['Los Angeles', 'Cancun', 'Paris']
, and I want to generate a dict with a key for each item in the list, and an empty array as value, like this:
cities_dict ={
'Los Angeles': [],
'Cancun': [],
'Paris': []
}
I tried this dict(([city.name], []) for city in cities))
, but I get a syntax error.
Is there any way I can get this dict without traversing list item by item?