Given the list (listEx) in the following code, I am trying to separate the string and integer and float types, and put them all in their own respective lists. If I want to extract strings only from listEx list, the program should go through listEx, and put the strings in a new list called strList and then print it out to the user. Similarly for integer and float types as well. But if I can just figure out the correct way to do just one, I'll be fine for the others. So far no luck, been at this for an hour now.
listEx = [1,2,3,'moeez',2.0,2.345,'string','another string', 55]
strList=['bcggg']
for i in listEx:
if type(listEx) == str:
strList = listEx[i]
print strList[i]
if i not in listEx:
break
else:
print strList
for i in strList:
if type(strList) == str:
print "This consists of strings only"
elif type(strList) != str:
print "Something went wrong"
else:
print "Wow I suck"