title: Print either an integer or a float with n decimals
body: <p>In Python, how can one print a number that might be an integer or real type, when the latter case would require me to limit my printout to a certain amount of digits?</p>
  
  <p>Long story short, say we have the following example: </p>
  
  <pre><code>print("{0:.3f}".format(num)) # I cannot do print("{}".format(num))
                               # because I don't want all the decimals
  </code></pre>
  
  <p>Is there a "Pythy" way to ensure e.g. in case <code>num == 1</code> that I print <code>1</code> instead of <code>1.000</code> (I mean other than cluttering my code with <code>if</code> statements)</p>