title: Using variables in the format() function in Python
body: <p>Is it possible to use variables in the format specifier in the format()-function in Python? I have the following code, and I need VAR to equal field_size:</p>
  
  <pre><code>def pretty_printer(*numbers):
    str_list = [str(num).lstrip('0') for num in numbers]
  
    field_size = max([len(string) for string in str_list])
  
    i = 1
    for num in numbers:
      print("Number", i, ":", format(num, 'VAR.2f')) # VAR needs to equal field_size
  </code></pre>