Skip to content

建议 chinese 返回一个对象, 以便用于数据处理 #7

Description

@chen-kay
from pydantic import BaseModel

class ZhModel(BaseModel):
    zh_year: str
    zh_month: str
    zh_day: str
    year_tiandi: str
    shengxiao: str

    def __str__(self):
        return f"{self.zh_year}{self.zh_month}{self.zh_day} {self.year_tiandi} ({self.shengxiao}年)"


class ZhDate1():
    def chinese(self):
        ......

        return ZhModel(
            zh_year=zh_year,
            zh_month=zh_month,
            zh_day=zh_day,
            year_tiandi=year_tiandi,
            shengxiao=shengxiao[(self.lunar_year - 1900) % 12],
        )

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions