python 3.x
This question already has an answer here:
You need to call the __str__
function. Try
my_var = Comment('name', 'content') print(str(my_var)) print('My message is: %s'.format(my_var)
上一篇: 调用时让对象返回它的字符串
下一篇: python 3.x
This question already has an answer here:
You need to call the __str__
function. Try
my_var = Comment('name', 'content') print(str(my_var)) print('My message is: %s'.format(my_var)
上一篇: 调用时让对象返回它的字符串
下一篇: python 3.x