- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
What is the difference between .py and .pyc files ?
Python compliles the .py files and save it as .pyc file
The .pyc contain the compiled bytecode of Python source files, A .pyc is not created for your main program file that you execute (only for imported modules).
The .pyc file contains encoded python bytecode.
If We Want to import module.The Module calculate Addition of Two Numbers
Example
def recursive_sum(n): """Function to return the sum of recursive numbers""" if n <= 1: return n else: return n + recursive_sum(n-1) # change this value for a different result number = 16 if number < 0: print("Enter a positive number") else: print("The sum is",recursive_sum(number))
Output
The sum is 136
If you store this program with the name "example",then it will be stored as "example.py" when you run a example.py file,it takes some to create a example.pyc file once the code is executed it first executes .py file where as code is first turned into byte code by the compiler in the form of "example.pyc” file.
- Related Articles
- What are .pyc files in Python?
- Difference Between .a and .so files
- What is __init__.py in Python?
- What is Host, and what is the difference between Nutrients and Nutrition?
- What is the difference between Java and JavaScript?
- What is the difference between JavaScript and ECMAScript?
- What is the difference between JavaScript and C++?
- What is the difference between HTML tags and ?
- What is the difference between jQuery and JavaScript?
- What is the difference between jQuery.size() and jQuery.length?
- What is the difference between jQuery and AngularJS?
- What is the difference between jQuery.show() and jQuery.hide()?
- What is the difference between jQuery.animate() and jQuery.hide()?
- What is the difference between = and: = assignment operators?
- What is the difference between time.clock() and time.time()?

Advertisements