print
、object
、 とはどう違いrepr()
ますか? 異なるフォーマットで印刷されるのはなぜですか?
を参照してくださいoutput difference
。
>>> x="This is New era"
>>> print x # print in double quote when with print()
This is New era
>>> x # x display in single quote
'This is New era'
>>> x.__repr__() # repr() already contain string
"'This is New era'"
>>> x.__str__() # str() print only in single quote ''
'This is New era'