본문 바로가기

2014/035

python - 입출력 문자열 색변경 from sys import platform from random import randint if platform.startswith('win'): from colorama import init init() colorList = { 'white': "\x1b[39m", 'yellow': "\x1b[33m", 'green': "\x1b[32m", 'blue': "\x1b[34m", 'cyan': "\x1b[36m", 'red': "\x1b[31m", 'magenta': "\x1b[35m", 'black': "\x1b[2m", 'darkwhite': "\x1b[37m", 'darkyellow': "\x1b[33m", 'darkgreen': "\x1b[32m", 'darkblue': "\x1b[34m", 'd.. 2014. 3. 31.
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.