擅长:python、mysql、java
<p>一个快速的解决方案是在每个<code>print x</code>之前打印空白行,如下所示:</p>
<pre><code>def promote(self):
x = PrettyTable(["Bot ID", "Bot Name"])
x.align["Bot ID"] = "l" # Left align city names
x.padding_width = 1 # One space between column edges and contents (default)
for bot_id, atts in self.bots.iteritems():
x.add_row([str(bot_id),atts['screenname']])
print '\n' * 1000 # as long as it clears the page text
print x
</code></pre>
<p>如果您绝对喜欢shell命令,您也可以将<strong>prettytable</strong>结果写入一个文件,然后调用<code>subprocess</code>并使用<code>watch</code>对其进行监视:</p>
^{pr2}$
<p>但我个人不喜欢这种方法。在</p>