How to Solve NameError: name 'punctuation' is not defined -- string

Solution: Import the 'punctuation' module

To Solve the error, add the following line to the top of your code.

from string import punctuation

 

For more information:
Python string punctuation