When I began learning Python, one of the first things I needed to know how to do was open a file. Now, the term “open a file” can mean different things depending on the context. Sometimes it means to actually open the file with Python and read from it, like with a text file. Other times, it means “to open the file in its default program”; and sometimes it means, “open the file in the program I specify”. So, when you go looking for how to do the latter two, you need to know how to ask Google just the right question or all you’ll end up with is learning how to open and read a text file.
In this article, we’re going to cover all three and we’ll also show how to open (or run) programs that are already installed on your PC. Why? Because that topic is also one of the first things I needed to learn and it uses some of the same techniques. (more…)