About this question
what is __pycache__ ? What do we do with the __pycache__ folder? Is it what we give to people instead of our source code? Is it just my input data? This folder keeps getting created, what is it for?
what is __pycache__ ? What do we do with the __pycache__ folder? Is it what we give to people instead of our source code? Is it just my input data? This folder keeps getting created, what is it for?
Log in to share your answer and help other learners.
Log in to answerBest Answer · By JanBask Python Expert
Answered on Jun 8, 2021
A __pycache__ folder is created when you use the line: import file_name. or try to get information from another file you have created. This makes it a little faster when running your program the second time to open the other file.
At the time when you run a program in python, the interpreter compiles it to bytecode first and after compilation interpreter stores it in the __pycache__ folder. So when you look in there you will find a bunch of files sharing the names of the .py files in your project's folder, you will see that their extensions will be either .pyc or .pyo. These files are bytecode-compiled and optimized bytecode-compiled versions of your program's files, respectively.
Claude Buckner Latest answer
Answered on Oct 7, 2025
__pycache__ stores compiled Python bytecode (.pyc files) to make programs start faster. You shouldn’t share it — only share your .py source files. It’s not your data, and you can safely delete it; Python will recreate it automatically. What are you waiting for? Play Unblocked Games now!
Free tutorials and interview questions from industry experts — learn the skill, then get ready to prove it.
Most-read guides across JanBask
Common Python interview questions, answered
Guides, tips and career advice on Python from JanBask experts.
Python How to Become a Python Developer: A Step-by-Step Guide for Beginners
Discover how to become a Python Developer via a practical 7-step guide build projects, maintain clean code, practice daily, and…
Python PCEP Certification Guide: Entry-Level Python Programmer Certification
Explore this PCEP certification guide for insights on cost, exam format, passing score, application, training, and study tips.…
Python Top 50+ Python Projects ideas for Beginners to Advanced
Discover innovative Python project ideas, explore advanced Python projects, and find good Python projects for beginners and…
Python How To Comment Out Multiple Lines In Python Like A Pro
Commenting out code is a common practice among programmers. It allows you to temporarily disable parts of your code without…