how to loop through a python enum

Solutions on MaxInterview for how to loop through a python enum by the best coders in the world

showing results for - "how to loop through a python enum"
Giovanni
29 Jan 2020
1from enum import Enum
2class Country(Enum):
3    Afghanistan = 93
4    Albania = 355
5    Algeria = 213
6    Andorra = 376
7    Angola = 244
8    Antarctica = 672
9for data in Country:
10    print('{:15} = {}'.format(data.name, data.value))
11