이 클래스를 고려하십시오. class foo(object): pass 기본 문자열 표현은 다음과 같습니다. >>> str(foo) "" 이 디스플레이를 사용자 지정 문자열로 만들려면 어떻게해야합니까? 도구__str__()또는__repr__()클래스의 메타 클래스에서. class MC(type): def __repr__(self): return 'Wahaha!' class C(object): __metaclass__ = MC print C 사용하다__str__읽을 수있는 문자열 화를 의미하는 경우__repr__모호하지 않은 표현을 위해. class foo(object): def __str__(self): return "representation" def __unicode__(self): return u"r..