what part didn't you understand ?
Let's say, we wanna import a module called X, which is a script called X.py Inside X.py, we have: class Test(object): pass class Test1(object): pass We only want to import Test1() from this script. The syntax for it in Python is: from X import Test1 And now we can use Test1(), just like that. But if we said: import X, we'd have to use Test1() like X.Test1() from is literally just an English "from". Where are you getting Test1() from? From X.py
Обсуждают сегодня