0

I don't quite understand what is the problem of my code below

for stripe in [sku.value for sku in model_sheet.col(13) if str(sku.value)]:

    try:



        stripe = int(stripe)



    except ValueError:



        stripe = unicode(stripe)



    for stars in [sku.value for sku in model_sheet.col(19) if str(sku.value)]: 



        yield HatInstance(hat_model, shade, cockade, rosette, color_ribbon, buttons, cover, stripe, stars, silk_band = silk_band)

it says there at line 9 column 5 IndentationError: unindent does not match any outer indentation level. Didn't I correctly followed the proper PEP8 indentions?

4
  • 2
    It looks like you've mixed tabs and spaces, you should use one or the other (preferably 4 spaces per indentation level). Commented Nov 27, 2014 at 10:41
  • 1
    @PrakharMohanrivastava that is an extremely poor suggested edit. Whitespace and indentation actually matters in Python. Please don't suggest edits unless you know the programming language. Commented Nov 27, 2014 at 10:46
  • @jonrsharpe it works fine when I correctly put the three blank lines... spent 3 hours just scrolling back and forth! Commented Nov 27, 2014 at 10:51
  • 1
    @Mahan yes, blank lines are ignored in Python, but if you're following PEP-0008 (and well done, you should!) see legacy.python.org/dev/peps/pep-0008/#blank-lines Commented Nov 27, 2014 at 10:52

2 Answers 2

1

Better remove all indentations and use tab of all indentations, this will resolve your issue. Python segregates code blocks based on indentations

Sign up to request clarification or add additional context in comments.

Comments

0

Your indentations are a mixture of tabs and spaces. That makes figuring out whether things line up difficult to determine. Replace all your tabs with sequences of spaces and you will be able to see whether things are lining up or not (more easily if you get rid of all the unnecessary blank lines).

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.