????

antimicrosoft 2002-05-08 08:40:46
#This is a Python introducer
#it can get your question and gine your answer

def PythonIntroducer(question):
"""I am a Python introdecer"""
RecognizeGrammer=["who are you","What's the Python",\
"Who are using the Python"]
Answer=[PythonIntroducer.__doc__,"Python is a Script Language",\
"Such as Yahoo!mail,Yahoo!pages"]
if question in RecognizeGrammer:
return Answer[RecognizeGrammer.index(question)]
else:
return "I don't understand what u said"

if__name__ == "__main__":
while 1:
question=raw_input("Hello World:")
print PythonIntroducer(question)

编译时显示:

G:\py\1>python hellow.py
File "hellow.py",Line 14
if__name__ == "__main__":
^
SyntaxError: invalid syntax

^记号打在:号的下面,什么地方错了???
...全文
6 点赞 收藏 2
写回复
2 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
limodou 2002-05-09
if 后面有空格吗?是不是少了?
回复
antimicrosoft 2002-05-09
谢谢你,正是这个问题

第一次写python程序,受c影响了
回复
发帖
其他
创建于2007-09-28

1.0w+

社区成员

Web 开发 其他
申请成为版主
帖子事件
创建了帖子
2002-05-08 08:40
社区公告
暂无公告