title: ValueError: Unknown format code 'g' for object of type 'str'
body: <p>I am new to Python and I am trying to write a simple print function but I am getting a strange error. This is my code:</p>
  
  <pre><code>#! /usr/bin/env python3.2
  import numpy as np
  
  a=np.arange(1,10,1)
  print(a)
  for i in a:
      print(i)
      print(type(i))
      print("{0:&lt;12g}".format(i))
  </code></pre>
  
  <p>The output is: </p>
  
  <pre><code>[1 2 3 4 5 6 7 8 9]
  1
  &lt;class 'numpy.int64'&gt;
  Traceback (most recent call last):
    File "./test.py", line 9, in &lt;module&gt;
      print("{0:&lt;12g}".format(i))
  ValueError: Unknown format code 'g' for object of type 'str'
  </code></pre>
  
  <p>Why does print take the "numpy.int64" as a string? I have to add that it works perfectly for a normal list: (e.g. [1,2,3,4]) I would be most grateful to any ideas on this issue, thanks ;-).</p>