这是代码,我遇到的问题是,虽然一切都按预期工作,但除非我指定完整的文件路径(如“s”),否则无法调用所需的 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