hutils icon indicating copy to clipboard operation
hutils copied to clipboard

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

Open maiyajj opened this issue 1 year ago • 0 comments

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"

maiyajj avatar Jun 28 '24 11:06 maiyajj