My question is about how to place multiple imports in a single line.
from sys import argv
from os.path import exists
Can we modify the above statements into a single statement like the one shown below:
from sys,os.path import argv,exists
Can we do it that way..?Please do correct me if I am wrong.
Nope, you can’t. Sorry!
The python
importstatement only supports one module to import statements from at a time.If you could do this, hypothetically speaking, what would the following mean:
what module would
Conditionbe imported from? Both modules define such a class.Python prefers explicit over implicit; you select one source from which to import at a time as that results in the least surprise and the greatest clarity as to what is happening.