Python’s self -learning enumeration Python enumeration rookie tutorial


#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# @Time    : 2019/4/29 16:36
# @Author: He Shengjin-HeShengjin
# @Site    : 
# @File    :
# @Software: PyCharm
"" "" 
 Enumerated use 
 "" "

from enum import Enum, unique
# import enum

month1 = Enum("month",('January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'))

class Month2(Enum):
    January = 'January'
    February = 'February'
    March = 'March'
    April = 'April'
    May = 'May'
    June = 'June'
    July = 'July'
    August = 'August'
    September = 'September '
    October = 'October'
    November = 'November'
    December = 'December'

if __name__ == '__main__':
    # traversal
    for name, meber in month1._member_map_.items():
        print('key--------->', name, ';value--------->', meber, ';index---------->', meber.value)
    for name,meber in Month2._member_map_.items():
        print('key--------->',name, ';value--------->', meber, ';index---------->', meber.value)


Random Posts

scrollView’s cycle rolling, no matter how many pictures loaded, the memory does not increase.

Create kernel equipment tree (Ti TRM)

FreertOS’s understanding of the priority macro

[Tiankeng, pit me for 2 days] Idea2019.2.2 and Maven3.6.2 are not compatible! Too tm pit

PHP converts the network picture into Base64 format to solve the cross -domain problem of HTML2CANVAS pictures