FRACTION类
| 483 | |
| 484 | |
| 485 | class Fraction: |
| 486 | """ |
| 487 | FRACTION类 |
| 488 | """ |
| 489 | |
| 490 | def __init__(self, fraction=None, chntext=None): |
| 491 | self.fraction = fraction |
| 492 | self.chntext = chntext |
| 493 | |
| 494 | def chntext2fraction(self): |
| 495 | denominator, numerator = self.chntext.split('分之') |
| 496 | return chn2num(numerator) + '/' + chn2num(denominator) |
| 497 | |
| 498 | def fraction2chntext(self): |
| 499 | numerator, denominator = self.fraction.split('/') |
| 500 | return num2chn(denominator) + '分之' + num2chn(numerator) |
| 501 | |
| 502 | |
| 503 | class Date: |