keep on getting str object has no attribute 'punctuation'
<p>Im trying to make a code that identifies punctuation in a word 
this is all I got up to:</p>

<pre><code>word=input('enter a word: ')
punctuation=set(word.punctuation)
for each in word:
   if each==punctuation:
     print('yes')
</code></pre>

<p>but it keeps on saying 'str' object has no attribute 'punctuation'
how do I solve this???</p>

<p><code>str</code> objects do not have a punctuation attribute. You can instead use <a href="https://docs.python.org/2/library/string.html#string.punctuation" rel="nofollow"><code>string.punctuation</code></a> to check for any punctuation in your word:</p>

<pre><code>import string

# string.punctuation '!"#$%&amp;\'()*+,-./:;&lt;=&gt;?@[\\]^_`{|}~'

for each in word:
   if each in string.punctuation:
       print('yes')
</code></pre>

python