I was modernizing some old % formatted string via regex substitution to change: # Old: 'Map: % 20s' % name # to New: 'Map: {: 20s}'.format(name) and was surprised a ValueError: Space not allowed in string format specifier As the same syntax is valid for numerics and this error did not yet show up on my search on StackOverflow. Why does this error happen in the new format and how to correctly write an equivalent formatting? Sitenotes: I explicitly do not want to use f-strings (yet) because there are many similar lines and it looks much neater using format instead. Related: Other alignment characters: ValueError: '=' alignment not allowed in string format specifier Same problem for f-strings. Space in f-string leads to ValueError: Invalid format specifier String formatting: % vs. .format vs. f-string literal Continue reading...