????

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

^记号打在:号的下面,什么地方错了???
...全文
47 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
limodou 2002-05-09
  • 打赏
  • 举报
回复
if 后面有空格吗?是不是少了?
antimicrosoft 2002-05-09
  • 打赏
  • 举报
回复
谢谢你,正是这个问题

第一次写python程序,受c影响了

10,606

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 其他
社区管理员
  • 其他
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧