Regular Expressions re.findall()
<p>I have a function which takes a count and a string as input. It should return a list of all words in that string of length count, and greater. Python however doesn't recognise my variable and returns an empty list.</p>

<pre><code>def word_number(count, string):
    return re.findall(r'\w{count,}', string)
</code></pre>

<p>How do I pass in the variable 'count' so that the function returns words of count and longer?</p>

<p>You can use <code>printf</code> style formatting:</p>

<pre><code>re.findall(r'\w{%s,}' % count, string)
</code></pre>

python regex