python - How to open a file for browsing (as if one opened it manually) -


I am trying to use Python to open a file for visual browsing, such as viewing a file Has been double clicked for one. I have tried many searches, but because the words are similar to the I / O file, I can not come in the proper information.

I think this is a very simple question / answer and if my answer was correct in front of my nose, then I apologize

Ideally, this is just a given There will be a call to the file path and Python will know the appropriate application that it wants to add, such as .pdf

  1. OS Stafffile ()

  2. os.system () but according to OS the parameters have been passed

    Windows: Open the file name Mac: Open the file Name: Linux: oowriter filename: gnome-open filename: kde-open filename etc ...

Example:

  Path for fileName = "File.pdf" // file 1. os.startfile (fileName) 2. os.system ("start% s")% fileName  

Comments

Popular posts from this blog

Member with no value in F# -

java - Joda Time Interval Not returning what I expect -

c# - Showing a SelectedItem's Property -