2024-09-30 20:29:11 发布
网友
当然,有某种抽象的东西允许这样做吗?在
这基本上就是命令
cmd = self._ghostscriptPath + 'gswin32c -q -dNOPAUSE -dBATCH -sDEVICE=tiffg4 -r196X204 -sPAPERSIZE=a4 -sOutputFile="' + tifDest + " " + pdfSource + '"' os.popen(cmd)
我觉得这条路很脏,一定有Python的路
使用subprocess,它将超过os.popen公司,尽管它不是一个抽象的概念:
from subprocess import Popen, PIPE output = Popen(["mycmd", "myarg"], stdout=PIPE).communicate()[0] #this is how I'd mangle the arguments together output = Popen([ self._ghostscriptPath, 'gswin32c', '-q', '-dNOPAUSE', '-dBATCH', '-sDEVICE=tiffg4', '-r196X204', '-sPAPERSIZE=a4', '-sOutputFile="%s %s"' % (tifDest, pdfSource), ], stdout=PIPE).communicate()[0]
如果只有python2.3没有子进程模块,那么仍然可以使用os.popen公司在
使用subprocess,它将超过os.popen公司,尽管它不是一个抽象的概念:
如果只有python2.3没有子进程模块,那么仍然可以使用os.popen公司在
^{pr2}$相关问题 更多 >
编程相关推荐