본문 바로가기

Programming60

python - decorator Blog :: Understanding Python Decorators in 12 Easy Steps! Ok, perhaps I jest. As a Python instructor, understanding decorators is a topic I find students consistently struggle with upon first exposure. That’s because decorators are hard to understand! Getting decorators requires understanding several functional programming concepts as well as feeling comfortable with some unique features of Pyth.. 2014. 3. 25.
Windows 서비스 프로그램 서비스를 동작시키기 위해서는 아래의 3가지 형태의 프로그램이 필요하다. 1. 서비스 프로그램 - 실제 작업을 처리하는 서비스 프로그램이다. 2. 서비스 설정 프로그램 - 서비스의 목록을 레지스트리(HKEY_LOCAL_MACHINE\System\CurrentControlSet\Service)에 DB형태로 저장해서 관리하는데 서비스 프로그램을 설치 및 제거하는데 사용된다. 3. 서비스 제어 프로그램 - 서비스 프로그램은 백그라운드에서 동작하기 때문에 사용자가 제어할 수 없다. 따라서 서비스 제어 프로그램을 이용해서 서비스 프로그램을 제어(중지, 시작 등)한다. [ 서비스 DB ] [HKEY_LOCAL_MACHINE\System\CurrentControlSet\Service 레지스트리 (service.msc와.. 2014. 3. 22.
python - 인코딩 관련 [example] "테스트"라는 문자열 ---> '\xc5\xd7\xbd\xba\xc6\xae' a = '\xc5\xd7\xbd\xba\xc6\xae'b = u'\xc5\xd7\xbd\xba\xc6\xae' a의 type은 strb의 type은 unicode str 타입인 경우에는 decode해서 unicode 타입이 되고unicode 타입인 경우에는 encode해서 str 타입이 된다. ex) u'some value'.encode('some value') -> '''some value'.decode('some value') -> u'' - a.decode('cp949')- b.encode('utf8') - 동일 함수 -#codecs.unicode_escape_decode#codecs.unicode_es.. 2014. 3. 2.
python - Thread 사용 Threading 모듈 (1). 아래와 같이 threading 모듈로 thread동작 함수를 등록해서 간단하게 사용할 수 있다. import threading def example(argv_0): print argv_0 th = threading.Thread(target=example, args=('hi',)) th.start() th.join() (2). Thread객체를 상속해서 run메소드를 재정의 한다. import time, threading class MyExample(threading.Thread): def __init__(self): threading.Thread.__init__(self) self.__suspend = False self.__exit = False def run(self).. 2014. 3. 1.