Skip to content

重写TupleEnum的__str__方法,让返回value #48

@maiyajj

Description

@maiyajj

class SecretEnum(TupleEnum):
SECRET = "secret", "敏感"
NO_SECRET = "no_secret", "非敏感"

>>>print(str(SecretEnum.SECRET))
>>>SecretEnum.SECRET

重写__str__:
class TupleEnum:
def __str__(self):
return self.value

>>>print(str(SecretEnum.SECRET))
>>>"secret"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions