I have a list like this:
list = ['abcd', '1.3', 'a', 'abcdef', '12345']
I need a command that gives me the elements that have length greater than 3 (abdc, abdcef, 12345). How can I do that?
[item for item in list if len(item) > 3]
If you want to read up more about this, it's called a "list comprehension".
I would use a list comprehension like this:
>>> list = ['abcd', '1.3', 'a', 'abcdef', '12345']
>>> [e for e in list if len(str(e)) > 3]
['abcd', 'abcdef', '12345']
>>>