On Thu, Mar 17, 2016 at 5:39 AM, Joel Goldstick <joel.goldst...@gmail.com> wrote: > can you show the complete code? It doesn't start with "{:02} I don't think
Actually, yes it does; I can confirm the OP's concern: $ python3 Python 3.6.0a0 (default:ae76a1046bb9, Mar 17 2016, 05:45:31) [GCC 5.3.1 20160121] on linux Type "help", "copyright", "credits" or "license" for more information. >>> "{:02}".format(1) '01' >>> "{:02}".format("1") Traceback (most recent call last): File "<stdin>", line 1, in <module> ValueError: '=' alignment not allowed in string format specifier >>> And I agree with the OP; the error message should not refer to the equals sign if that wasn't present. Check the bug tracker at bugs.python.org to see if it already exists, and if it doesn't, create an issue. The message _is_ technically correct; here's what the docs say: """ Preceding the width field by a zero ('0') character enables sign-aware zero-padding for numeric types. This is equivalent to a fill character of '0' with an alignment type of '='. """ However, this is definitely confusing; for positive integers, alignment '=' is identical to alignment '>', which is (a) the default for numbers, and (b) valid for strings (using "{:>02}" cures the error). So go ahead and create the tracker issue, suggesting alternative wording for the message. ChrisA -- https://mail.python.org/mailman/listinfo/python-list