Skip to content
Advertisement

Why did I get ModuleNotFoundError?

I tried the following code to import pprint from pprint module like import matplotlib.pyplot as plt. But I got an error instead. Why did I get this error?

JavaScript
JavaScript

Advertisement

Answer

Because there’s no module pprint.pprint, only a module pprint. You mean:

JavaScript

(From the module pprint import the name pprint as p.)

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement