How to Solve NameError: name 'zipfile' is not defined

Solution: Import the 'zipfile' module

# Add the following line to the top of your code
import zipfile

 

For more information:
Python zipfile