import collections
listEx = [1, 2, 3, 'moeez', 2.0, 2.345, 'string', 'another string', 55]
oftype = collections.defaultdict(list)
for item in listEx:
    oftype[item.__class__].append(item)
for key, items in list(oftype.items()):
    pass
Separating list elements in Python