code: def open_file(filename):
      
      if sys.platform.startswith("darwin"):
          subprocess.call(("open", filename))
      elif sys.platform == "cygwin":
          subprocess.call(("cygstart", filename))
      elif os.name == "nt":
          os.system("start %s" % filename)
      elif os.name == "posix":
          subprocess.call(("xdg-open", filename))
docs: Multi-platform way to make the OS open a file with its default application