我的python程序有一个缩进错误

时间:2015-05-19 18:15:27

标签: python indentation

我正在尝试编写一个基本程序,但是当我尝试运行它时,我收到错误from os import system from time import sleep while True: input = raw_input("How are you doing?") if input == "good": print "That's great!" sleep(3) elif input == "bad": print "How come?" sleep(3) else: print "What? sleep(3) 并且我无法弄清楚哪个部分我没有缩进。这是代码:

<Location /svn>
  DAV svn
  SVNParentPath /var/svn
  AuthType Basic
  AuthName "Subversion Repository"
  AuthUserFile [tothefile]
  Require valid-user
  SSLRequireSSL
</Location>
<Location /svn/subrepo>
  DAV svn
  SVNParentPath /var/svn/subrepo
  AuthType Basic
  AuthName "Subversion Repository"
  AuthUserFile [toanotherfile]
  Require valid-user
  SSLRequireSSL
</Location>

完成了最新版本的python2。如果你能提供帮助,那就太棒了。

1 个答案:

答案 0 :(得分:1)

from os import system
from time import sleep

while True:
   input = raw_input("How are you doing?")
   if input == "good":
      print "That's great!"
      sleep(3)
   elif input == "bad":
      print "How come?"
      sleep(3)
   else:
      print "What?"
      sleep(3)

编辑:您需要缩进while循环。并在最后一个print语句中添加引号。