-5

This line

for i,k in (p[0].__dict__).items():
    print (i,type(k))

prints

code_event <class 'str'>
code_event_system <class 'str'>
event_no <class 'int'>
group_no <class 'int'>

My desired output(for collections.nametuple0

code_event str
code_event str

How to fix this?

MisterMiyagi
  • 44,374
  • 10
  • 104
  • 119
Djikii
  • 167
  • 2
  • 9

1 Answers1

2

Use __name__

for i,k in (p[0].__dict__).items():
    print (i,type(k).__name__)
>>> a = "hi"
>>> type(a).__name__
'str'
>>>
bigbounty
  • 16,526
  • 5
  • 37
  • 65