import module == from module import *?

后端 未结 3 2067
自闭症患者
自闭症患者 2021-01-16 12:06

I had a problem with the Django tutorial so I asked a question here. No-one knew the answer, but I eventually figured it out with help from Robert. Python seems to be trea

3条回答
  •  佛祖请我去吃肉
    2021-01-16 12:50

    As we discussed in the comments, the problem is not with the code, but the way you are updating the source. python caches modules in sys.modules. You can reload individual modules using the reload function, but for many changes it's best to reload the entire shell. In many cases it looked as though the changes had propagated because the error messages seemed to have changed, this is because python doesn't cache the source code of the file, so when it references code, it shows you the newest version. Hopefully now, you can apply the other answers with more success.

提交回复
热议问题