For example :

lst = ['1234','2341','123']

And should be:

 lst = ['1234', '2341'] 

'123' - did not fit because there are less than four characters

    2 answers 2

     lst = ['1234', '2341', '123'] lst = [item for item in lst if len(item) >= 4] 
       filter(lambda x: len(x) >= 4, lst)