Python: needs more than 1 value to unpack

Posted by Rosarch on Stack Overflow See other posts from Stack Overflow or by Rosarch
Published on 2010-04-09T16:29:44Z Indexed on 2010/04/09 16:33 UTC
Read the original article Hit count: 307

Filed under:
|
|

What am I doing wrong to get this error?

    replacements = {}
    replacements["**"] = ("<strong>", "</strong>")
    replacements["__"] = ("<em>", "</em>")
    replacements["--"] = ("<blink>", "</blink>")
    replacements["=="] = ("<marquee>", "</marquee>")
    replacements["@@"] = ("<code>", "</code>")

    for delimiter, (open_tag, close_tag) in replacements: # error here
        message = self.replaceFormatting(delimiter, message, open_tag, close_tag); 

The error:

Traceback (most recent call last):
File "", line 1, in for shit, (a, b) in replacements: ValueError: need more than 1 value to unpack

All the values tuples have two values. Right?

© Stack Overflow or respective owner

Related posts about python

Related posts about syntax