I have noticed .pyc
files spontaneously being generated when some .py
file of the same name gets run. What is the difference between .py
and .pyc
files?
Also, I find that having .pyc
files lying around clutters up space. Should one delete .pyc
files? Or is there a benefit and/or necessity to having them around?
UPDATE: Here are 2 answered questions that are related to my question
http://stackoverflow.com/questions/2998215/if-python-is-interpreted-what-are-pyc-files
http://stackoverflow.com/questions/3878479/python-pyc-files-main-file-not-compiled
This Question is not a Duplicate
Reason 1: Because I am asking what the difference between these two files are. The question S.Lott found named 'If Python is interpreted, what are .pyc files?' is not asking what the difference between .py and .pyc files are. It is asking what .pyc files are.
Reason 2: Because my secondary questions 'Should one delete .pyc
files? Or is there a benefit and/or necessity to having them around?' provide even more information on .pyc files and how one should handle them.
Reason 3: Because when a beginner Python programmer like myself wants to find out What is the difference between .py and .pyc files? , they will have no problem finding out the answer as they will be guided directly to my question. This helps reduce search time since the question is right to the point.