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

Solution: Import the 'literal_eval' module

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

from ast import literal_eval

 

For more information:
Python ast literal_eval