我正在用Python创建一个在终端上运行的基于文本的冒险,但是在我进行之前,我想知道是否可以将其上传到web或创建一个Facebook应用程序而不必重写所有内容。我在网上搜索了好几个小时,试图找到能让我做到这一点的东西。我发现了一种叫做IronPython的东西,但是我不知道如何按照我想要的方式使用它。在
我的代码包含以下内容:
def pillar_start2():
print "North end of a pillared corridor."
print "There is a passage to the East and West."
print "Upon closer inspection you notice some Hieroglyphs."
itemcheck(ipillar_start)
print
prompt_start()
def prompt_start():
global gold
prompt_h = raw_input("Type a command: ").lower()
try:
global northroom
global eastroom
global westroom
global southroom
if prompt_h in northroom:
print "There is no room to the North."
print
prompt_start()
elif prompt_h in eastroom:
empty_room()
所以具体地说,我的问题是:如何在重写最少代码的同时,将上述代码用作facebook应用程序。在
干杯,雅各布(我曾有过用另一种编程语言运行我的python脚本的想法,但到目前为止还没有成功。这也许是因为我只知道Python和Unix。)
我能想到的最简单的方法就是在线创建一个控制台
https://www.python.org/单击“启动交互式Shell”
读一篇关于它的博文http://blog.pythonanywhere.com/83/
主程序可重启:(Idea)
或者您可以使用https://trinket.io/或pythonfidle
在pythonanwhere上,我们有一个(稍微隐藏的)特性,叫做“gist控制台”。如果您将脚本保存为github上的github,那么您可以通过控制台与互联网上的任何人共享它,该控制台将自动加载该要点:
https://www.pythonanywhere.com/gists/
下面是一个例子:
https://www.pythonanywhere.com/gists/5502596/robot.py/ipython3/warning
所以你可以通过github上的gisthub编辑你的代码,当你想查看你的更改时,你可以点击github上的save,然后点击pythonanwhere gist控制台链接上的refresh,查看更新后的版本。。。在
相关问题 更多 >
编程相关推荐