else:
tkMessageBox.showinfo('Report Created', 'Your report was sucessfully created')
file = 'Student Report.txt'
os.system('TextEdit'+file)
I am writing a program that creates a report from data from a database, writes that data to a text file and then is supposed to launch that text file so that it can be printed.
How do I achieve this?
I have attempted to use webbrowser but no luck.
解决方案
You can use the /usr/bin/open OSX utility:
NAME
open -- open files and directories
SYNOPSIS
open [-e] [-t] [-f] [-F] [-W] [-R] [-n] [-g] [-h] [-b bundle_identifier] [-a application] file ... [--args arg1 ...]
DESCRIPTION
The open command opens a file (or a directory or URL), just as if you had double-clicked the file's icon. If n