Update page 'Day 9 homework - Sloetjes'

xuanyi.wang
2023-04-19 04:57:21 +02:00
parent 220397b889
commit 794f261ed7
+2 -2
@@ -74,6 +74,6 @@ print(login)
> When the name variable is of the form package.module, normally, the top-level package (the name up till the first dot) is returned, not the module named by name. However, when a non-empty fromlist argument is given, the module named by name is returned.
* In the code above, the name of the module is '"os"', and the fromlist argument is not given, so the top-level package '"os"' is returned, which is equivalent to importing os with a regular import statement.
* In the code above, the name of the module is `"os"`, and the fromlist argument is not given, so the top-level package `"os"` is returned, which is equivalent to importing os with a regular import statement.
Therefore, the expression '__import__('os').getlogin()' is equivalent to 'os.getlogin()', but it dynamically imports the 'os' module at runtime instead of using a regular import statement.
Therefore, the expression `__import__('os').getlogin()` is equivalent to `os.getlogin()`, but it dynamically imports the `os` module at runtime instead of using a regular import statement.