For loop printing memory location of class instead of list

后端 未结 4 1311
不思量自难忘°
不思量自难忘° 2021-01-28 01:24

I have some code which seems to print [<__main__.TCar object at 0x0245C1B0>] but I want it to print the actual contents of the list.

class TCa         


        
4条回答
  •  终归单人心
    2021-01-28 01:53

    print the attribute one by one rather than printing garange once: print(self.attribute).Note that the attribute in the code is an instance of the object

提交回复
热议问题