0

I am not an expert Pythonista per se so I will begin with that as a clarification for me asking what could be a considered a trivial question about an else statement issue I have. Anyway for the sake of brevity, I went through all of the else syntax questions on stackoverflow regarding the same/similar issues and I was still unable to resolve the problem. Here is the code block in question:

 else: m_len -= 33 dst.append(32) n, m_len = divmod(m_len, 255) dst.extend("\x00" * n) dst.append(m_len) dst.append((m_off << 2) & 0xff) dst.append((m_off >> 6) & 0xff) else: #This is the line being complained about m_off -= 0x4000 if m_len <= 9: dst.append(0xff & (16 | ((m_off >> 11) & 8) | (m_len - 2))) 

Thanks in advance for any help or advise that can be offered! Cheers!

2 Answers 2

5

You can't have more than one else statement in a single conditional block
Change the first else to elif and specify some condition

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

Comments

1

You conditions must be like that:

if (condition):#the program can choose as many "if" as many you put in your program (in theory) ..code.. #here you can add as many "if" as you want elif (condition):#the program will only choose one block you must have a "if" block before ..code.. #here again you can add as many "elif" as you want else:#before "else" you must have a if block before ..code.. #here only one "else" 

how do you think the program could choose else or else?! lol

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.