使用googleappengin部署基于控制台的python应用程序

2024-06-25 05:29:56 发布

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

如何在googleappengine中部署基于控制台的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 error.so我给出静态值。之后日志文件中就没有错误了。 现在,我的问题是如何在googleappengine中查看输出? 或者是否有任何命令在命令提示符下运行它

提前谢谢


Tags: toinputrawrealcurrencycurrenciesprintrupee
1条回答
网友
1楼 · 发布于 2024-06-25 05:29:56

你可以在googleappengine中运行这个程序,但是你所尝试的并不适合在那里运行。相反,您可以在PC上安装Python运行时(我假设它是Windows PC)。从这里下载安装程序:https://www.python.org/downloads/release/python-2711/

安装后,可以在命令提示符下运行程序。将编写的代码保存到文件(例如currency.py)中,并使用python解释器运行它

C:\> python currency.py

相关问题 更多 >