我试图用Genie创建一个简单的helloworld程序,但是我希望能够在终端上输入一些输入。我的目标是在Genie中重复以下python代码:
#!/usr/bin/env python
print 'Hello. I am a python program.'
name = raw_input("What is your name? ")
print "Hello there, " + name + "!"
到目前为止,我所做的是
[indent=4]
uses System
init
print "Hello. I am a python program."
var name = Console.ReadLine("What is your name? ")
print "Hello there, " + name + "!"
但我有一些错误,可能是因为我对语言一无所知,这里是错误:
hw.gs:4.5-4.10: error: The namespace name `System' could not be found
System
^^^^^^
Compilation failed: 1 error(s), 0 warning(s)
hw.gs:3.6-3.11: error: The namespace name `System' could not be found
uses System
^^^^^^
Compilation failed: 1 error(s), 0 warning(s)
我做错什么了?你知道吗
谢谢。你知道吗
BigOldTree帮我提了一个建议,实际上很管用。下面是Geanie中的代码:
我不知道是否有可能把论据发给你标准读取线()就像python中的原始输入()一样。很高兴知道,而且我不知道如何找到有关特定函数的信息以及如何导入它们。我来自R,在那里我可以用吗?function(),这会给我一些关于它的说明。精灵和瓦拉有什么相似的地方吗?你知道吗
如果愿意,可以编写自己的
raw_input
函数:相关问题 更多 >
编程相关推荐