Jump to content


Photo

Ch 2 - Pg 56


  • Please log in to reply
1 reply to this topic

#1 liviavg

liviavg

    New Member

  • Members
  • Pip
  • 1 posts

Posted 05 July 2013 - 11:15 AM

Hi, I'm stuck in this page, I try to run the code from page 56 but I keep getting this:
~/Documents$ python3 nester.py
File "nester.py", line 12
print("\t", end=' ')
^
TabError: inconsistent use of tabs and spaces in indentation

#2 paulbarry

paulbarry

    Advanced Member

  • O'Reilly Author
  • PipPipPipPipPipPipPipPip
  • 307 posts

Posted 08 July 2013 - 11:50 PM

When it comes to indenting code in Python, you can use tabs or spaces, but not both. You must consistently use one or the other. If you mix tabs and spaces in your code, Python gets confused. To fix this problem in IDLE (with your code in the Edit Window), choose "Select All" from the "Edit" menu, then choose "Untabify Region" from the "Format" menu. That should get rid of the TabError.

Hope this helps.

--Paul.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users