<p>您可以使用<code>ljust</code>执行以下操作:</p>
<pre><code>for k,v in dic.items():
a,b = k.split(':')
print a.ljust(30), b.ljust(30), v
</code></pre>
<p>将打印以下内容:</p>
<pre><code>S00 D58 1
M23 Q14 1
S43 H52 84
S43 H53 2
S43 H50 5
S43 H57 1
M87 E11 10
</code></pre>
<p>从<a href="https://docs.python.org/2/library/string.html#string.ljust" rel="nofollow">doc</a>:</p>
<blockquote>
<p>These functions respectively left-justify, right-justify and center a
string in a field of given width. They return a <strong>string that is at
least width characters wide</strong>, created by padding the string s with the
character fillchar (default is a space) until the given width on the
right, left or both sides. The string is never truncated.</p>
</blockquote>
<p>请注意,还可以使用<a href="https://docs.python.org/2/library/string.html#format-specification-mini-language" rel="nofollow">format</a>来获得相同的效果:</p>
<pre><code>print '{:<30s}{:<30s}{}'.format(a, b, v)
</code></pre>