我想用sys.stdout
来显示进度。没有百分比,因为我不知道最大值,所以我不能使用进度条库。你知道吗
问题是,我需要调用sys.stdout.write()
超过1000次,这使得命令行不负责任。它甚至不会响应KeyboardInterrupt
。尽管print没有问题,但我还是想使用sys.stdout
,因为它可能有助于日志记录。你知道吗
这是我的密码:
while len(self.tocrawl) != 0:
self.__crawling()
sys.stdout.write('Crawled {} URLs!\r'.format(self.nb_url))
sys.stdout.flush()
目前没有回答
相关问题 更多 >
编程相关推荐