To use a specific submodule or class from a Python library, you should import it using the correct syntax. In this case, you want to import the manager class from the ncclient library. The correct import statement is:
'from ncclient import manager'
Option B: import manager
This option is incorrect because it does not specify the module 'ncclient' to import 'manager.' Python would not recognize 'manager' without its module.
Option C: 'from ncclient import *'
This imports all public attributes from the 'ncclient' library, which is not ideal for clarity and can lead to potential conflicts. It is better practice to import only what you need explicitly.
Option D: 'ncclient manager import'
This option is syntactically incorrect in Python and would result in a syntax error.
This is a confusing aspect of Python.
ncclient isn't a module but rather a package that contains the module manager (manager.py)
The question is, would you get an error that the module could not be found if you only imported the package even if you called the function by its full package.module.function()?
If so, then you would need "from ncclient import manager"
Or you could 'import ncclient.manager" in which case when calling connect(), you would need the full path.
https://www.programiz.com/python-programming/package
This is correct, you must leave import ncclient. If you only have "from ncclient import manager" the code must be updated to remove ncclient from the line "ncclient.manager.connect".
Problem though is that with A, the snippet "with ncclient.manager.connect" would have to be "with manager.connect", which is what the github example has.
This section is not available anymore. Please use the main Exam Page.350-401 Exam Questions
Log in to ExamTopics
Sign in:
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.
Upvoting a comment with a selected answer will also increase the vote count towards that answer by one.
So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.
cvndani
Highly Voted 3 years, 4 months agoAbdullahMohammad251
Most Recent 9 months, 2 weeks ago[Removed]
1 year agoHarwinderSekhon
1 year, 11 months agodanman32
1 year, 11 months agoXDR
2 years, 1 month agosecretuser
1 year, 1 month agoM_Abdulkarim
2 years, 9 months agorlilewis
3 years agorettich
3 years, 3 months agobogd
3 years, 3 months agoCHGclimber
3 years, 3 months agodanman32
1 year, 10 months agoTrust48
3 years, 4 months ago