Python: Find the location of Python module sources
Python Basic: Exercise-146 with Solution
Write a Python program to find the location of Python module sources.
Sample Solution :-
import sys
print("\nList of directories in sys module:")
print(sys.path)
print("\nList of directories in os module:")
import os
print(os.path)
============ RESTART: F:/Python_APSC/py-ex-basic-146.py ===========
List of directories in sys module:
['F:/Python_APSC', 'C:\\Users\\User\\AppData\\Local\\Programs\\Python\\Python35-32\\Lib\\idlelib', 'C:\\Users\\User\\AppData\\Local\\Programs\\Python\\Python35-32\\python35.zip', 'C:\\Users\\User\\AppData\\Local\\Programs\\Python\\Python35-32\\DLLs', 'C:\\Users\\User\\AppData\\Local\\Programs\\Python\\Python35-32\\lib', 'C:\\Users\\User\\AppData\\Local\\Programs\\Python\\Python35-32', 'C:\\Users\\User\\AppData\\Local\\Programs\\Python\\Python35-32\\lib\\site-packages']
List of directories in os module:
<module 'ntpath' from 'C:\\Users\\User\\AppData\\Local\\Programs\\Python\\Python35-32\\lib\\ntpath.py'>
>>>
沒有留言:
張貼留言