Text formatting error: '=' alignment not allowed in string format specifier?

What does '=' alignment mean in the following error message, and why does this code cause it? >>> "{num:03...

How to format a QString??

I'd like to format a string for Qt label, I'm programming in C++ on Qt. In ObjC I would write something like: NSS...

ValueError: cannot switch from manual field specification to automatic field numbering?

The class: class Book(object): def __init__(self, title, author): self.title = title self.autho...

String formatting with “{0:d}”.format gives Unknown format code 'd' for object of type 'float'?

If I understood the docs correctly, in python 2.6.5 string formatting "{0:d}" would do the same as "%d" with the Str...

Display number with leading zeros?

Given: a = 1 b = 10 c = 100 How do I display a leading zero for all numbers with less than two digits? This is t...

What is the purpose of dollar sign in this Python3 string formatting expression??

"(%d goals, $%d)" % (self.goals, self.penalties) Original question: String Formatting in Python 3 Python3 Format S...

Python, print all floats to 2 decimal places in output?

I need to output 4 different floats to two decimal places. This is what I have: print '%.2f' % var1,'kg =','%.2f' ...

Use StringFormat to add a string to a WPF XAML binding?

I have a WPF 4 application that contains a TextBlock which has a one-way binding to an integer value (in this case, ...

TypeError: unsupported operand type(s) for %: 'NoneType' and 'str'?

So I am VERY new to programming and I started with Python 3. I started reading "Learn Python the Hard Way". Now, I g...

Using Python String Formatting with Lists?

I construct a string s in Python 2.6.5 which will have a varying number of %s tokens, which match the number of entr...

Convert hex to binary?

I have ABC123EFFF. I want to have 001010101111000001001000111110111111111111 (i.e. binary repr. with, say, 42 digit...

Named placeholders in string formatting?

In Python, when formatting string, I can fill placeholders by name rather than by position, like that: print "There...

Display a decimal in scientific notation?

How can I display this: Decimal('40800000000.00000000000000') as '4.08E+10'? I've tried this: >>> '%E' %...