执行多个Python脚本文件并传递变量python3.6的值

2024-09-27 00:17:51 发布

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

我在python脚本文件中使用以下3个变量。你知道吗

sourcePath、knopath、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

另外,我想得到脚本文件的输出。你知道吗


Tags: py脚本redshiftsyspluscalldatasetwork

热门问题