title: How to format a number with comma every four digits in Python?
body: <p>I have a number <code>12345</code> and I want the result <code>'1,2345'</code>. I tried the following code, but failed:</p>
  <pre><code>&gt;&gt;&gt; n = 12345
  &gt;&gt;&gt; f&quot;{n:,}&quot;
  '12,345'
  </code></pre>