FILE - It is a name location on secondary storage media where data are permanently stored.
फ़ाइल - यह सेकेंडरी स्टोरेज मीडिया पर एक नाम स्थान है जहां डेटा स्थायी रूप से संग्रहीत किया जाता है।
File has two types - Text File and Binary File
फ़ाइल दो प्रकार की होती है - टेक्स्ट फ़ाइल और बाइनरी फ़ाइल
Text File -
1. Text file consists of human readable characters.
2. It is opened using text editor.
3.It is a sequence of characters consisting of alphabets, numbers and other special symbols.
4. These files with extensions like .txt, .py, .csv etc.
फ़ाइल - यह सेकेंडरी स्टोरेज मीडिया पर एक नाम स्थान है जहां डेटा स्थायी रूप से संग्रहीत किया जाता है।
File has two types - Text File and Binary File
फ़ाइल दो प्रकार की होती है - टेक्स्ट फ़ाइल और बाइनरी फ़ाइल
Text File -
1. Text file consists of human readable characters.
2. It is opened using text editor.
3.It is a sequence of characters consisting of alphabets, numbers and other special symbols.
4. These files with extensions like .txt, .py, .csv etc.
टेक्स्ट फ़ाइल -
1. टेक्स्ट फ़ाइल में मानव पठनीय वर्ण होते हैं।
2. इसे टेक्स्ट एडिटर का उपयोग करके खोला जाता है।
3. यह अक्षरों, संख्याओं और अन्य विशेष प्रतीकों से युक्त वर्णों का एक क्रम है।
4. ये फ़ाइलें .txt, .py, .csv आदि जैसे एक्सटेंशन वाली होती है
1. टेक्स्ट फ़ाइल में मानव पठनीय वर्ण होते हैं।
2. इसे टेक्स्ट एडिटर का उपयोग करके खोला जाता है।
3. यह अक्षरों, संख्याओं और अन्य विशेष प्रतीकों से युक्त वर्णों का एक क्रम है।
4. ये फ़ाइलें .txt, .py, .csv आदि जैसे एक्सटेंशन वाली होती है
Binary File -
1. They are stored in computer in sequence of bytes. ( 0 and 1 )
2. These files are not human readable.
3. They do not represent the ASCII values of characters.
बाइनरी फ़ाइल -
1. वे कंप्यूटर में बाइट्स के क्रम में स्टोर होते हैं। ( 0 और 1 )
2. ये फ़ाइलें मानव पठनीय नहीं हैं।
3.वे वर्णों के ASCII मूल्यों का प्रतिनिधित्व नहीं करते हैं।
Opening a file (Opening a file )
To open a file in python we use open( ) function.
Syntax - file_object( File_Name, access_ mode)
file_object has certain attributes which tell us basic information about the file
File_name object tells the file name.
access_mode returns the mode in which file is opened, It is an optional argument.
Example of access mode - <r> opens the file in read only mode.
<w> opens the fie in write mode.
<a> opens the file in append mode
पायथन में एक फाइल खोलने के लिए हम open () का उपयोग करते हैं।
Syntax - file_object( File_Name, access_ mode)
file_object में कुछ विशेषताएँ होती हैं जो हमें फ़ाइल के बारे में बुनियादी जानकारी बताती हैं
File_name ऑब्जेक्ट फ़ाइल का नाम बताता है।
access_mode वह मोड देता है जिसमें फ़ाइल खोली जाती है, यह एक वैकल्पिक तर्क(optional argument ) है
एक्सेस मोड का उदाहरण - <r> opens the file in read only mode.
<w> opens the fie in write mode.
<a> opens the file in append mode
Closing a file - After completing all operation on file it is a good practice to close file
python provide a close () to close the file
syntax - file_object.close()
python make sure using close method that any unsaved dat is flushed off to the file
before it is closed.
फ़ाइल बंद करना (Closing a file )
Writing to a text file-Before writing in file first we need to open file in writing mode('w') OR append mode ('a')
No comments:
Post a Comment
if you have any doubt. please let me know.