File and Error Handling
Hamza Fatnaoui
Software Engineer | AI/ML Practitioner | LLMs Enthusiast | Competitive Programmer | Math & Tech Lover
Hello there
File is just an object that is created in our operating system. File can be a source code, video and photo...
JSON FILE:
Json file (JavaScript Object Notation): As we know, computers communicate. And to communicate, they need a language. Imagine Python and Javascript want to send each other information, they both don't need to learn Python and Javascript. Instead, they use the common language of communication in programming, JSON, to send each other messages can then be translated from JSON into their respective language. The same problem if you are traveling to different countries. You need to learn each language for every country. But wouldn't be better is instead of learning one language for every country, you could learn just English, which let us assume is understand in most of the countries.
Now, why JSON file is easy to read and structured data format? Let's say you would like to place an order for your dinner. You can say --> May i have a three eggs, no no three not two with one "la vache qui rit" and this "harcha" and a cup of milk, please <-- This takes time, and for 100 orders a day ( just the ones who wake up for dinner), this is a lot of time wasted in explaining.
Instead, what if there was a standard format to take the order? the restaurant could save a lot of time. Let's say it took the order in this format -->
egg count: 3
"la vache qui rit": 1
领英推荐
"harcha": 1
"milk": one cup
The above would be more easier for the server to note and to communicate to the chef. it is the same analogy how json work between languages, easy to read and structured format.
I will update my work to add explanations to other files. Please visit my GitHub repository file_and_error_handling and check the technical section in the file handling with Python