How to Solve NameError: name 'operator' is not defined -- ast

Solution: Import the 'operator' module

# Add the following line to the top of your code
from ast import operator

 

For more information:
ast operator