1

我正在从另一个模块运行 python 命令,该命令在调用时将打印出 2300 万行。我想知道是否有办法做类似的事情:

function_call_here() 
for every 100,000 lines of output to stdout 
    store output as a list of 100,000 strings
    pickle output 
    save as "output_XXXX" where XXXX is an identifier (i.e.,0015 if on batch 15)
    print "read batch X"

我意识到这只是伪代码,但我将不胜感激!

4

0 回答 0