KnowledgeBoat Logo
|

Computer Science

In how many ways can you import objects from a module?

Python Modules

1 Like

Answer

We can import objects from a module in 3 ways :

  1. import statement can be used to import a module. The syntax is import <module_name>.

  2. Python's from statement is used to import specific attributes or individual objects from a module into the current module or namespace. The syntax is from <module_name> import <function_name(s)>.

  3. import * statement can be used to import all names from a module into the current calling (namespace) module. The syntax is from <module_name> import *.

Answered By

2 Likes


Related Questions