-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
  • 36,972
  • 7
  • 82
  • 99
Djikii
  • 137
  • 1
  • 8

1 Answers1

1

Use __name__

for i,k in (p[0].__dict__).items():
    print (i,type(k).__name__)
>>> a = "hi"
>>> type(a).__name__
'str'
>>>
bigbounty
  • 14,834
  • 4
  • 27
  • 58