Why am I getting Name Error when importing a class?

前端 未结 4 1042
我在风中等你
我在风中等你 2020-12-18 08:07

I am just starting to learn Python, but I have already run into some errors. I have made a file called pythontest.py with the following contents:



        
4条回答
  •  无人及你
    2020-12-18 08:31

    You're supposed to import the names, i.e., either

     import pythontest
     f= pythontest.Fridge()
    

    or,

    from pythontest import *
    f = Fridge()
    

提交回复
热议问题