Table of Contents
Python Tutorial
Table of Contents
Python Tutorial
Python Modules in Hindi
What is Modules in Python
Modules एक ऐसे python files होते है जिसमे organized and reusable code लिखे होते है। किसी module में basically Classes, Functions, Variables, etc. runnable ही होते है, जिनको हम अपने program में import करके reuse कर सकते है।
Pre-defined Modules
Python में कई सारे pre_defined modules होते है जिनको हम simply अपने program में import करके use कर सकते है, जैसे-
math
इस module में बहुत से mathematical functions होते है।
ramdom
इस module का use करके हम random numbers को generate कर सकते है।
datetime
इस module का use date और time के manipulation में किया जाता है।
Creating a Modules
जैसा की हमने अभी discus किया कि Modules के python file ही होते है इसलिए module को create करने के लिए हमे सबसे पहले एक python file create करना होगा फिर हम उसमे code को लिखेंगे, हम जैसा चाहे वैसा code लिखा सकते है जैसे कि अगर हमे कुछ functions को अपने program में बार-बार use करना है तो हम उन सभी functions की coding इस module लिख सकते है फिर हम इस module को अपने किसी भी program में import करके इसमे लिखे सभी functions को access कर सकते है।
How to Import a Module
किसी भी module को किसी दूसरे module या फिर किसी script (program) में import करने के लिए “import” statement का use करते है।
हम चाहे तो एक module के किसी specific item को भी import कर सकते है।
Aliasing
कोई module को import करने के बाद उसके items को use करने के लिए हमे उस module के नाम को लिखना होता है but किसी module का नाम हमे बड़ा लग रहा है और हम चाहते है की उसे एक छोटे स nickname देकर उस module और उसके items को use करे तो हम aliasing करते है, इसके लिए हमे सिर्फ “as” statement का use करना होगा।
उम्मीद करते है कि आपको Python Modules अच्छे समझ मे आ गया होगा । अपने learning को continue रखने के लिए next button पर click करे,
- All Posts
- Artificial Intelligence
- Computer Fundamentals
- Computer Networks
- Data Analytics
- Data Science
- DBMS
- Deep Learning
- Digital Electronics
- DSA with Python
- Excel
- Exercise
- Git & Github
- Machine Learning
- Matplotlib
- Natural Language Processing
- NumPy
- Operating System
- Pandas-s
- Power BI
- Python Tutorial
- Scikit-learn
- Seaborn
- SQL & MySQL

Table of Contents All Chapters 1. Personal Area Network 2. Local Area Network 3. Campus Area Network 4. Metropolitan Area...

Table of Contents All Chapters 1. Data Communication 2. Types of Data Communication 2.1. Simplex 2.2....

Table of Contents All Chapters 1. Special Logic Gate 2. XOR Gate 2.1. XOR Gate Truth Table 3....

Table of Contents All Chapters 1. Universal Logic Gates 2. NOR Gate 2.1. NOR Gate Truth Table 3....

Table of Contents All Chapters 1. Logic Gate 2. AND Gate 2.1. AND Gate Truth Table 3. OR...

Table of Contents All Chapters 1. Simplification 2. Simplification using Boolean Algebra Theorems 3. Simplification using K-map Digital Electronics...

Table of Contents All Chapters 1. Identity Laws 2. Null Laws 3. Domination Laws 4. Idempotent Laws 5. Complement Laws...