0
Why was .pyc file created?
I created a file KingKong.py: def KingKong(): print("Kingkong kingkong kingkong!") input("King?") print("Kong!") if __name__ == "__main__": print("Sorry") Then I executed Kong.py: import KingKong KingKong.KingKong() But why was KingKong.cpython-36.pyc created with text: 3 ��<[� � @ s d d� Z edkred� dS )c C s t d� td� t d� d S )NzKingkong kingkong kingkong!zKing?zKong!)�print�input� r r �0/storage/emulated/0/S/Python_project/KingKong.py�KingKong s r �__main__ZSorryN)r �__name__r r r r r �<module> s
3 ответов
+ 6
Python automatically compiles your script to compiled code, so called byte code, before running it.
When a module is imported for the first time, or when the source is more recent than the current compiled file, a .pyc file containing the compiled code will usually be created in the same directory as the .py file.
http://effbot.org/pyfaq/how-do-i-create-a-pyc-file.htm
+ 1
.pyc file is created on the first run and contains a bytecode: https://docs.python.org/3.5/glossary.html#term-bytecode
The structure of the bytecode may depend on interpreter used to run python code.
+ 1
you can delete them no worries, they will spawn when needed