How does opening file work | Sololearn: Learn to code for FREE!


How does opening file work

Ofcuruse it's not necessary open it could be any function that opens file like fstream in c++ etcI was wondering how the open() function in python works on the operating system like how does it read a file not the code but what happeneds in the computer

9/6/2019 8:07:24 PM


21 Answers

New Answer


Python is implemented with C, or a C based language. If you want to understand how Python opens a file, you should start your investigation with how C opens a file, how a system call works, etc.


C++ is also a C based language, as is Java (jpython), hence why I said it's useful to first look at how C handles file I/O. The practice is generally shared across the entire family of C based languages


Cout This should be helpful in understanding the fundamentals of file I/O at the system level:


Cout, you're here *asking* for something. You don't have to be happy with an answer, but complaining and downvoting the first guy giving you *something* is dubious style. There is something called 'tone'. At the very least, the effect will be that other people hesitate to give you their answer.


Cout am sure if you have done better Googling you won't say sh*t about does who are trying to help you out on your quest for knowledge, because this is actually not a problem to be solve that someone can actually help you on, its a quest you actually need to work for, atleast appreciate there effort and they will definitely find more for you, as Core have said earlier "no better place than the documentation itself" no one is an island of knowledge


Not sure if these are helpful.


Cout, there are friendly ways to say that an answer doesn't help you to solve your problem. If people get the impression that you're being a jerk, they'll likely lose interest in helping you, simple as that.


Well. Python calls OS specific API to open a file. OS calls the driver, depending on the disk type, the driver calls the firmware of the device, the firmware does his unique and specific hardware control to gather a single byte and return it to the driver.

+2 You can see also:


MIT app inventor is easiest check on web


no better place than the documentation itself,


literally I sent you the documentation for every built in function currently in python, if you were to go on the website there is a clear description on what open() does/is. If you need further instructions on how to navigate the website I’d be more than happy, if not you could always look up a tutorial.


Ace you are right sorry for that and it's not just python it's also c++ and even notepad


Core dude you sent me a list of functions that's not what I asked for


Core you misunderstood the question I asked what it does in the computer in the os not how to use it


Cout locates a file and opens it, returns a file object. I/O, parameters sets restrictions/permissions.


Cout Python is open source, this is as “complex” as it gets.


What is the making of a great programmer? Is it being a coder or developer or winning many simple challenges?



HonFu Man you are talking nonsense if someone gives me an answer that gives me nothing also if he answered doesn't metter if you don't know the answer don't answer why is it metter that if someone knows the answer he won't answer I know for me I couldn't care less