I am trying to find words in regular expression with length 4
I am trying this but I am getting an empty list:
#words that have length of 4 s = inpu
No need for a (possibly) complicated regex, you can just use a list comprehension:
>>> s = "here we are having fun these days" >>> [word for word in s.split() if len(word) == 4 and word.isalpha()] ['here', 'days'] >>>