Xuzheng Wang
Xuzheng Wang

Reputation: 531

for loop in dictionary in python

future_to_url = {executor.submit(getHotelURLs, url): url for url in cityURLs}

The above code is from an concurrent.futures example in https://docs.python.org/3/library/concurrent.futures.html

It seems to me that a for loop is used in a dictionary. I am wondering if there is a documentation about this?

Upvotes: 1

Views: 66

Answers (1)

Santos
Santos

Reputation: 194

This is dict comprehensions. You should view the doc of list comprehensions (it works similar to dict comprehension)

Upvotes: 1

Related Questions