你如何在python中运行perl脚本

时间:2016-11-26 08:21:42

标签: python perl

我需要帮助。当我尝试在python中运行perl脚本时,这就出现了。

print "What do you like?"
print "1.Cheese burgers"
print "2.hot dogs"
choice = input(" [>] what do you like? ")

if choice == 1:
    #Now this is where the perl script comes in.
    eval(__import__('os').system('perl script.pl'))

但是当我运行这个时,perl代码会出现,但屏幕底部会显示这条消息,说明这一点。

Traceback (most recent call last):
File "tool.py", line 8, in <module>
eval(__import__('os').system('perl script.pl'))
TypeError: eval() arg1 must be a string or code object
#Now the perl code comes up but i want this message to go away 

0 个答案:

没有答案