Find out all the punctuations in a sentence that has been put into a list
<p>I have this variable:</p>

<pre><code>Words = ["Hi",".","how","are","you","?","I","feel","like","I","could",",","do","better"]
</code></pre>

<p>From this I want a variable that finds all the punctuations and puts it into a list as well. Like this:</p>

<pre><code>Punctuations = [".","?",","]
</code></pre>

<p>The solution using <code>re.findall</code> function:</p>

<pre><code>import re

Words = ["Hi",".","how","are","you","?","I","feel","like","I","could",",","do","better"]
Punctuations = re.findall("[^\w\s]+", ''.join(Words))

print(Punctuations)  # ['.', '?', ',']
</code></pre>

python list punctuation