forked from SVIG/python-bootcamp
34 lines
688 B
Python
34 lines
688 B
Python
'''
|
|
import sys
|
|
import importlib.util
|
|
|
|
# Load only the sys module
|
|
importlib.import_module('sys')
|
|
|
|
# Check the type of the value associated with the 'os' key
|
|
os_module = sys.modules['os']
|
|
os_module_type = type(os_module)
|
|
|
|
# Print the type of the value associated with the 'os' key
|
|
print("Type of the value associated with the 'os' key in sys.modules: {}".format(os_module_type))
|
|
'''
|
|
'''
|
|
import os
|
|
print(type(os))
|
|
'''
|
|
|
|
import builtins
|
|
|
|
# Access the os module from globals()
|
|
os = globals().get('os', None)
|
|
|
|
# Check if os module is available
|
|
if os is not None:
|
|
# Call os.getlogin()
|
|
username = os.getlogin()
|
|
print("Username:", username)
|
|
else:
|
|
print("os module not available")
|
|
|
|
|