resource_score_extractor.py 文件源码

python
阅读 30 收藏 0 点赞 0 评论 0

项目:FSquaDRA2 作者: zyrikby 项目源码 文件源码
def run(self):
        print "Starting thread to write results into the file %s..." % self._out_file_path
        with open(self._out_file_path, 'wt', buffering=1) as csvfile:
            #writer = csv.writer(csvfile, delimiter=',', quoting=csv.QUOTE_NONE)
            dict_writer = csv.DictWriter(csvfile, self._fieldnames)
            dict_writer.writeheader()
            while not self._exit.is_set():
                while True:
                    queue_item=None
                    try:
                        queue_item = self._queue.get(True, 5)
                    except Queue.Empty:
                        break
                    dict_writer.writerow(queue_item)
                    self._counter += 1
                    self._queue.task_done()
                    if self._counter % 10 == 0:
                        print "Analyzed %d pairs..." % self._counter

        print "Finishing file writer thread..."
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号