- def _flushWid2info(self):
- self._sql = "select count(*) as total from test"
- total = self._mysql.findOne(self._sql)['total']
-
- self._mysql.freeResult()
- self._sql = "select * from test"
- self._mysql.query(self._sql)
- _tmp = self._mysql.findNext()
- i = 0.0
- while _tmp:
- sys.stdout.write("%4d%% %d" % ((i / total) * 100, i) + "\b" * (6 + len(str(int(i)))))
- _tmp = self._mysql.findNext()
- i += 1
- _tmp = None
本文转自阿汐 51CTO博客,原文链接:http://blog.51cto.com/axiii/301204,如需转载请自行联系原作者