I have a list which consists irregular words and float
numbers, I'd like to delete all these float
numbers from the list, but first I need to find a way to detect them. I know str.isdigit()
can discriminate numbers, but it can't work for float
numbers. How to do it?
My code is like this:
my_list = ['fun','3.25','4.222','cool','82.356','go','foo','255.224']
for i in my_list:
if i.isdigit() == True:
my_list.pop(i)
# Can't work, i.isdigit returns False