Ron Paulfan Ron Paulfan - 6 months ago 31
Python Question

Find string greater than (x) in length

How can I search through a variable and look for a word/string that is greater than 20 in length?

var = '''this is my example and I want
no find the following
string jakjajsiwjsjwijaksjdfjaiwjalskdjfiajwlajfklajsdfwi
from this variable'''



Using a list comprehension:

print [x for x in var.split() if len(x) > 20]