2

I want to know the difference between these two declarations:

from matplotlib import pyplot as plt
import matplotlib.pyplot as plt

Specifically the word from.
Can anyone help me to understand it?

imxitiz
  • 3,920
  • 3
  • 9
  • 33
TungMuzan
  • 21
  • 2
  • 2
    The result is exactly the same. You can read https://docs.python.org/3/tutorial/modules.html. These will create a reference to the same module accessible with the name 'plt'. – Corralien Mar 30 '23 at 09:13
  • 1
    See https://stackoverflow.com/questions/9439480/from-import-vs-import for various description of the syntactic difference. – Matt Pitkin Mar 30 '23 at 09:17

0 Answers0