以正确的方式打印列表python

这个问题在这里已经有了答案:

  • 在Python 8中获取实例的类名答案

  • 您有一个类型对象列表,并且类型对象的__str____repr__都有一个<type 'x'> __repr__ <type 'x'>形式。

    如果您想打印类型对象的名称列表,则需要手动执行转换:

    print [t.__name__ for t in values]
    
    链接地址: http://www.djcxy.com/p/40941.html

    上一篇: print list in proper way python

    下一篇: Can you get the instance variable name from a Python class?