如何在谷歌应用引擎中部署基于控制台的python应用程序?
这是我的示例代码:
import webapp2
currencies = {
"Rupee":"(Indian Rupee)",
"Real":"(Brazilian Real)",
"Dollar":"(US Dollar)",
"Euro":"(Euro)",
"Pound":"(Great Britain Pound)"
}
def real_to_dollar():
user_value = raw_input("How many rupee?")
ammount = 43
conversion = ammount / 3.59
print str(user_value) + " rupee is equal to " + str(conversion)+pound."
print "Welcome to currency converter."
print "Supported currencies:"
for currency in currencies:
print currency + " " + currencies[currency]
#user_choice1 = raw_input("Convert: ")
#user_choice2 = raw_input("To: ")
user_choice1 ="Real"
user_choice2 ="Dollar"
if user_choice1 == "Real" and user_choice2 == "Dollar":
real_to_dollar()
elif user_choice1 == "Dollar" and user_choice2 == "Real":
dollar_to_real()
else:
print "Enter valid one!!"
使用运行时值时,日志文件显示EOF错误。因此我给出了静态值。之后,日志文件中没有错误。 现在,我的问题是如何在谷歌应用引擎中查看输出? 或者是否有任何命令在命令提示符下运行它?
提前致谢。
答案 0 :(得分:1)
您可以在Google AppEngine中运行此功能,但您尝试做的并不适合在那里运行。相反,您可以在PC上安装Python Runtime(我假设它是一台Windows PC)。从此处下载安装程序:https://www.python.org/downloads/release/python-2711/
安装完成后,您可以在命令提示符下运行程序。将您编写的代码保存到文件,例如currency.py,并使用python解释器运行它。
C:\> python currency.py