I was wondering if there were a way in python to loop through a list and check if a list element was of a certain type. Something like this in incorrect pseudo code.
listt = ['3109', datetime.timedelta(0, 240), datetime.timedelta(0, 60), '2411',
datetime.timedelta(0, 2160), '3109']
for i in listt:
if type(i) is class.__str__:
print('success')
Is it possible to check for type like this? Also, I found myself unable to iterate through a list with timedelta objects so I've had to except a TypeError every time I encounter one. That is not shown in this code.
I appreciate any help. Thanks