What is the difference between `>>> some_object` and `>>> print some_object` in the Python interpreter?

前端 未结 5 1190
礼貌的吻别
礼貌的吻别 2020-12-11 19:31

In the interpreter you can just write the name of an object e.g. a list a = [1, 2, 3, u\"hellö\"] at the interpreter prompt like this:

>>&         


        
5条回答
  •  生来不讨喜
    2020-12-11 19:49

    print(variable) equals to print(str(variable))

    whereas

    variable equals to print(repr(variable))

    Obviously, the __repr__ and __str__ method of the object h5file produce different results.

提交回复
热议问题