Skip to content

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

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"

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions