如何用python在mac osx上打开文件

2024-10-05 12:20:23 发布

您现在位置:Python中文网/ 问答频道 /正文

我试图使用eclipse在mac上用python打开一个文件。

FileName = "/Users/fis/Desktop/installation_guide.txt"
ss = subprocess.Popen(FileName, shell=True)
ss.communicate()

还有os.popen(FileName)。但文件没有打开。这些代码在windows中运行良好。但是,我不知道麦克有什么问题。我想打开一个文件,就像双击windows打开一个文件,而不是像在控制台读取文件内容和打印一样。文件存在于mac上的桌面位置


Tags: 文件txtwindowsmacinstallationshellfilenamess

热门问题