Problem:
You are trying to use Python format strings like
"Hello %.3 world" % 1.234
but you see an error message like
--------------------------------------------------------------------------- ValueError Traceback (most recent call last) <ipython-input-4-7cbe94e4525d> in <module> ----> 1 "Hello %.3 world" % 1.234 ValueError: unsupported format character ' ' (0x20) at index 9
Solution:
Your format string %.3
is incomplete ! You need to specify the type of value to format, e.g. f
for floating point, d
for integers, s
for strings etc. So instead of %.3
, write %.3f
, or instead of just %
write e.g. %f
, %d
or %s
depending on the data type of the variable you want to insert there.