0
这是代码,我遇到的问题是,尽管一切按预期工作,除非指定完整的文件路径(如在“s”中),否则不能调用所需的perl脚本。 ,即使它们都在同一个目录(桌面)中。任何帮助,将不胜感激。从python调用perl没有完整的文件路径
import subprocess
status = ['s', 'mj', 'ms', 'h','q']
while(1):
while(1):
print("Compute income tax: \n")
print("\ts = single \n")
print("\tmj = married and filing jointly \n")
print("\tms = married and filing seperately \n")
print("\th = head of household \n")
print("\tq = quit \n")
#get user input for status
choice=raw_input("Enter status: ")
if (choice in status):
print("58")
break
else:
print("Unknown status!")
if (choice=='q'):
break
else:
if (choice=="s"):
subprocess.call('perl C:/Users/Username/Desktop/single.pl')
elif(choice=='mj'):
subprocess.call('perl marriedJointly.pl')
elif(choice=='ms'):
subprocess.call('perl marriedSeperately.pl')
elif(choice=='h'):
subprocess.call('perl head.pl')
#and so on
呃,不,我打开命令提示符窗口并输入完整的文件路径并执行它。我打开cmd并将文件拖到窗口中,然后按回车。 – user2167980
哦,明白了,这是其他文件的问题,谢谢你的帮助。 – user2167980