When I'm importing something in Python, in this case import time
, where is time
being imported from? Where is the module located prior to import? I tried using dir() on the __builtin__
and other folders in my interpreter, but it's not there.
I have looked in the c:\python folder and a search turns up nothing for a file named time
but nonetheless time.sleep(1) works just fine, so it is imported. Is it being automatically downloaded from the network?
I ultimately want to import some other modules for text coloring, but I need to know where this one came from first. Thanks.
Further to Aarons "motivations to your question" edit:
[u'',
'C:\\Program Files (x86)\\PyScripter\\Lib\\rpyc.zip',
'C:\\Windows\\system32\\python27.zip',
'C:\\Python27\\DLLs', 'C:\\Python27\\lib',
'C:\\Python27\\lib\\plat-win',
'C:\\Python27\\lib\\lib-tk',
'C:\\Python27', <--- This location
'C:\\Python27\\lib\\site-packages']
This is what i get. Im gonna guess from whats been said, by J.F.Sebastian, that the time module is in the above location marked (C:\Python27) (in the executable file), although my first guess would have been within a file within the lib folder.
I looked for collections
and that is an independent file, so even though that too is the Standard Library, it exists in a file on the disk and i know where it is exactly. I would like to know this too for time
(im guessing its in the .exe).
If i was to save my own modules in the above marked location (if not where), would i save it as examplemodule[no file extension], examplemodule.py?, and if saved with an extension would i have to import it with the extension i.e. import examplemodule.py? or not.
This is a question (the extension bit) which would probably be answered for me, if i simply could see the file it is on the disk, but being either compiled into the python executable or in the Libs directory i cannot. Thanks again