def open_file(filepath):
"""Open file using OS default settings"""
if sys.platform.startswith('darwin'):
subprocess.call(('open', filepath))
elif os.name == 'nt':
os.startfile(filepath)
elif os.name == 'posix':
subprocess.call(('xdg-open', filepath))
else:
raise NotImplementedError("OS not supported: {0}".format(os.name))
评论列表
文章目录