Use 'import module' or 'from module import'?

前端 未结 19 2568
一向
一向 2020-11-21 07:47

I\'ve tried to find a comprehensive guide on whether it is best to use import module or from module import. I\'ve just started with Python and I\'m

19条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-11-21 08:13

    To add to what people have said about from x import *: besides making it more difficult to tell where names came from, this throws off code checkers like Pylint. They will report those names as undefined variables.

提交回复
热议问题