0
didnt run On my Python 2.7
class SpecialString: def __init__(self, cont): self.cont = cont def __truediv__(self, other): line = "=" * len(other.cont) return "\n".join([self.cont, line, other.cont]) spam = SpecialString("spam") hello = SpecialString("Hello world!") print(spam / hello) error at my PYTHON IDLE: Traceback (most recent call last): File "<pyshell#2>", line 1, in <module> print spam/hello TypeError: unsupported operand type(s) for /: 'instance' and 'instance'
1 ответ
0
What are you intending to do in the print statement?