6c886dce42ebprojects/transdate/reference.ko.txt132:6c886dce42eb |
224:1d46270eb038 → |
-rw-r--r--/projects/{pyfunge,transdate,versert,vlaah-python} added.
1 ## vim: syn=mako 2 <%! title = u'레퍼런스' %> 3 4 transdate의 기능은 두 가지 방법, 즉 개별 함수와 lunardate라는 하나의 큰 클래스로 제공됩니다. 둘이 제공하는 기능은 거의 유사합니다. 5 6 7 함수 8 ==== 9 10 <strong id="sol2lun-func">sol2lun</strong>(*year*, *month*, *day*, *leap*=False) 11 : 양력 날짜를 받아서 음력 날짜를 나타내는 <`(year, month, day, leap)`> 튜플로 반환합니다. 입력의 *leap*는 lun2sol과의 호환성을 위한 것으로 무시되며, 출력의 *leap*는 윤달일 때 True, 아니면 False로 설정됩니다. 잘못된 날짜거나 범위를 벗어 나면 ValueError를 냅니다. 12 13 <strong id="lun2sol-func">lun2sol</strong>(*year*, *month*, *day*, *leap*=False) 14 : 음력 날짜를 받아서 양력 날짜를 나타내는 <`(year, month, day, False)`> 튜플로 반환합니다. 입력의 *leap*는 윤달일 때 True, 아니면 False로 설정해야 합니다. 잘못된 날짜거나 범위를 벗어 나면 ValueError를 냅니다. 15 16 <strong id="getganzistr-func">getganzistr</strong>(*index*, *locale*=None) 17 : 간지의 번호(0~59)를 입력하면 *locale*에 대응하는 언어로 대응되는 문자열 표기를 반환합니다. *locale*은 <`'ko'`>(한국어), <`'ja'`>(일본어), <`'zh'`>(중국어) 중 하나이며, 생략되면 기본 로캘을 사용합니다. 18 19 : >>> import transdate 20 >>> print transdate.getganzistr(34, 'ko') 21 무술 22 23 <strong id="strftime-func">strftime</strong>(*format*, *t*=None) 24 : 기본 라이브러리의 time.strftime과 유사한 역할을 합니다. *format*에는 strftime이 지원하는 지정자와 더불어 다음 지정자를 추가로 쓸 수 있습니다. 25 26 : * <`%LC`>: 음력 년도의 세기 부분. (2007이면 20) 27 * <`%Ld`>: 음력 날짜. [01-30] 28 * <`%Le`>: <`%Ld`>와 같으나 앞에 붙는 0은 공백으로 치환됨. 29 * <`%LF`>: <`%LY-%Lm-%Ld`>와 동일함. 30 * <`%Lj`>: 음력 해에서 몇 번째 날짜인가? [001-390] 31 * <`%Ll`>: 윤달이면 1, 윤달이 아니면 0. 32 * <`%Lm`>: 음력 달. [01-12] 33 * <`%Ly`>: 음력 년도에서 세기를 뺀 두 자리. [00-99] 34 * <`%LY`>: 네 자리 음력 년도. 35 36 37 lunardate 클래스 38 ================ 39 40 이 클래스는 datetime.date와 호환되며, 거의 유사한 인터페이스를 지니고 있습니다. 다음은 lunardate에만 있는 속성 및 메소드입니다. 41 42 <small>생성자:</small> <strong id="lunardate">lunardate</strong>(*year*, *month*, *day*, *leap*=False) 43 : 지정된 음력 날짜에 해당하는 lunardate 객체를 만듭니다. 인자의 의미는 lun2sol 함수와 같습니다. 44 45 <strong id="lunaryear">lunaryear</strong> 46 : 47 <strong id="lunarmonth">lunarmonth</strong> 48 : 49 <strong id="lunarday">lunarday</strong> 50 : 51 <strong id="lunarleap">lunarleap</strong> 52 : datetime.date 클래스의 year, month, day 속성과 같지만, 음력 날짜를 반환합니다. lunarleap는 윤달일 때 True를 반환합니다. 53 54 <strong id="tosolardate">tosolardate</strong>() 55 : 해당 객체와 같은 날짜인 datetime.date 객체를 반환합니다. 56 57 <small>클래스 속성:</small> <strong id="min">min</strong> 58 : 59 <small>클래스 속성:</small> <strong id="max">max</strong> 60 : datetime.date 클래스의 min, max 속성과 같지만, lunardate 객체를 대신 반환합니다. 현재 min은 양력 1881년 1월 30일(음력 1월 1일), max는 양력 2051년 2월 10일(음력 12월 29일)로 설정되어 있습니다. 61 62 <strong id="replace">replace</strong>(*year*=None, *month*=None, *day*=None, *leap*=None) 63 : dateime.date 클래스의 replace 메소드와 같지만, 인자로 음력 날짜를 받아 들입니다. 64 65 <small>클래스 메소드:</small> <strong id="fromsolardate">fromsolardate</strong>(*solardate*) 66 : datetime.date 객체인 *solardate*와 같은 날짜인 lunardate 객체를 만들어서 반환합니다. 67 68 <small>클래스 메소드:</small> <strong id="today">today</strong>() 69 : 70 <small>클래스 메소드:</small> <strong id="fromtimestamp">fromtimestamp</strong>(*timestamp*) 71 : 72 <small>클래스 메소드:</small> <strong id="fromordinal">fromordinal</strong>(*ordinal*) 73 : datetime.date 클래스의 today, fromtimestamp, ordinal 메소드와 같지만, lunardate 객체를 대신 반환합니다. 74 75 <strong id="getganzi">getganzi</strong>() 76 : 육십간지를 나타내는 <`(year_ganzi, month_ganzi, day_ganzi)`> 튜플을 반환합니다. 각각 년, 월, 일에 해당하는 육십간지의 번호(0부터 59까지의 정수)이며, getganzistr 함수를 써서 문자열로 바꿀 수 있습니다. 77 78 <strong id="getganzistr">getganzistr</strong>(*locale*=None) 79 : getganzi()와 같으나 <a href="#getganzistr-func">getganzistr</a> 함수를 사용하여 문자열로 바뀐 튜플을 반환합니다. 80 81 <strong id="strftime">strftime</strong>(*format*) 82 : <a href="#strftime-func">strftime</a> 함수를 사용하여 음력 날짜를 포매팅합니다. 83 84 그 외에 datetime.timedelta와의 연산도 제공됩니다. 85 86 87 기타 88 ==== 89 90 lunardate와 짝이 되는 solardate 클래스가 제공됩니다. 이 클래스는 단순히 datetime.date의 별명입니다. 또한 datetime.timedelta 클래스도 편의를 위해 제공됩니다. 91