2013-10-08 20 views
0

我在python 3.3.3中製作一個基於文本的遊戲。這是我的代碼:錯誤不一致使用標籤怎麼辦

print ("You must answer all questions in block capitals") 
    print ("Welcome to maze runner") 
    print ("To learn about the controls press C") 
    print ("To learn the about the different types T") 
    print ("To play press START") 
    run = input() 
    #Controls 
    if run == "C": 
     print ("To attack press H") 
     print ("To walk forward press W") 
     print ("To turn left press A") 
     print ("To turn right press D") 
     print ("To turn around press S") 
     print ("To block press B") 
     print ("To open stats press Q") 
     print ("To open this screen press C") 
     print ("To close this screen press C") 
     #Types 
    if run == "T": 
     print ("Soldier. Press S for more info") 
     print ("Archer. Press A for more info") 
     print ("Mage. Press M for more info") 
     print ("Shape shifter. Press SS for more info") 
     type_info = input() 
     #Solider info 
     if type_info == "S": 
      print ("Soldier: Good at close combat") 
      print ("   Weak at long range combat") 
      print ("   Average speed") 
      print ("   Average blocker") 
      print ("Press S to go back") 
     #Archer info 
     if type_info == "A": 
     print ("Archer: Weak at close combat") 
    print ("  Good at long range combat") 
    print ("  Good speed") 
    print ("  Average blocker") 
    print ("press A to go back") 

我得到的錯誤是「不一致的使用縮進製表和空格」,它則突出了線的末尾:

  print ("  Good at long range combat") 

什麼是錯的?上述

enter image description here

是從記事本屏幕截圖++:當您使用的編輯器,可以顯示選項卡和空格字符

+0

可能是您正在使用空格和製表符。 –

+0

這條消息告訴你什麼? ''不一致地使用縮進中的製表符和空格「 – karthikr

+0

我知道這意味着什麼,但它突出顯示的速度後沒有空格 – dashernasher

回答

1

問題變得更加明顯。第36行至第39行使用製表符(箭頭)和空格(點)的組合縮進。將每個選項卡替換爲一定數量的空格(如果您希望打印語句在if type_info == "A"條件塊內),請使用一定數量的空格替換(10個空格)

相關問題