In: Computer Science
PYTHON Suppose you need to import a single class named GeneTools from a module named bioinformatics, in Python. Which of the following represents the correct use of an import statement?
import GeneTools from bioinformatics |
||
from bioinformatics import GeneTools |
||
from bioinformatics import * |
||
import GeneTools |
Ans: from bioinformatics import GeneTool
Explanation:
While other options are:
import GeneTools from bioinformatics: bioinformatics is the module that contains GeneTools, but not the other way around.
So, this option is incorrect.
from bioinformatics import * - This will import all the functions and classes from the module bioinformatics not just a single class. So, this option is incorrect, since only a single class needs to be imported.
import GeneTools - This option is incorrect as there is no module named GeneTools.