执行多个Python脚本文件&传递变量的值 - Python 3.6

时间:2018-01-22 14:36:15

标签: python python-3.x subprocess

我在python脚本文件中使用了以下3个变量。

sourcePath,knoxPath,redShiftKeyFolderPath

我想传递这些变量的值&使用下面的脚本执行它们。

import sys, subprocess

knoxPath = r"C:\sunil_plus\dataset\knoxFile.xlsx"
redShiftKeyFolderPath = r"C:\sunil_plus\redShift"

sourcePath = 'C:\sunil_plus\dataset\Source1'
subprocess.call([sys.executable, r"D:\Sunil_Work\1_redShift.py", 'htmlfilename.htm']) # want to pass knoxPath, redShiftKeyFolderPath, sourcePath

sourcePath = 'C:\sunil_plus\dataset\Source2'
subprocess.call([sys.executable, r"D:\Sunil_Work\2_redShift.py", 'htmlfilename.htm']) # want to pass knoxPath, redShiftKeyFolderPath, sourcePath

sourcePath = 'C:\sunil_plus\dataset\Source3'
subprocess.call([sys.executable, r"D:\Sunil_Work\3_redShift.py", 'htmlfilename.htm']) # want to pass knoxPath, redShiftKeyFolderPath, sourcePath

另外,我想得到脚本文件的输出。

0 个答案:

没有答案