ASH84

Software Engineer/Developer, co-founder of Payhere. Ex-Banksalad. Intereseted in iteroperability, bootstrap company, writting.

[Python] enum 정의하기

created:2012-10-03
updated:2017-03-28
edit

사실 파이썬에 다른 언어처럼 enum 이라는 타입은 딱 정의된 것은 없으나 찾아보니 다음과 같이 range 함수를 이용해서 숫자를 처음에 할당하는 방식으로 사용한다고 한다. 최근에 사용한 것은 실행인자로 어떤 문자열을 받아서 프로그램내에서 모드(mode) 를 정의 하였다. 


다음과 같이. 


#dev  #enum  #Python  #RANGE  #모드 정의하기  #파이썬