Import specific Python function without importing entire module
Question:
When importing a Python module, how can you import specific functions from that module without importing the entire module, and what is the correct syntax?
from module_name import function_name
import function_name from module_name
import module_name.function_name
from module_name as function_name
Answer:
A - is the correct answer. The correct way to import a specific function from a module is using from module_name import function_name. This allows the function to be used directly without loading the entire module, which is more memory efficient