How to Solve NameError: name 'AnyStr' is not defined -- typing

Solution: Import the 'AnyStr' module

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

from typing import AnyStr

 

For more information:
Python typing AnyStr