示例#1
0
def bp_process_bp(infile, outfile, automode=False):
    if not automode:
        # 文件大小
        size1 = os.path.getsize(infile)
        infile = read_input(infile)
        if infile == None:
            return None
    
    # read to internal2
    lst = datamachine.bp_to_internal2(infile)
    
    if not automode:
        datamachine.print_bp_head(lst)
    
    # process
    lst = datamachine.process_internal2(lst)
    
    # get output
    output = datamachine.internal2_to_bp(lst)
    if output == None:
        return None
    
    # 写文件
    if automode:
        return output
    else:
        write_output(output, outfile, show_size=False)
        
        size2 = os.path.getsize(outfile)
        print('输入文件{0}字节,输出文件{1}字节'.format(format(size1,','),
                                                    format(size2,',')
                                                    )
              )
        return None
示例#2
0
def bp_process_bp(infile, outfile, automode=False):
    if not automode:
        # 文件大小
        size1 = os.path.getsize(infile)
        infile = read_input(infile)
        if infile == None:
            return None
    
    # read to internal2
    lst = datamachine.bp_to_internal2(infile)
    
    if not automode:
        datamachine.print_bp_head(lst)
    
    # process
    lst = datamachine.process_internal2(lst)
    
    # get output
    output = datamachine.internal2_to_bp(lst)
    if output == None:
        return None
    
    # 写文件
    if automode:
        return output
    else:
        write_output(output, outfile, show_size=False)
        
        size2 = os.path.getsize(outfile)
        print('输入文件{0}字节,输出文件{1}字节'.format(format(size1,','),
                                                    format(size2,',')
                                                    )
              )
        return None
示例#3
0
文件: tz2txt.py 项目: zhufeng/tz2txt
def statistic(infile):
    size = os.path.getsize(infile)
    print('编排文件{0},共{1}字节\n'.format(infile, format(size,',')))
          
    lst = datamachine.bp_to_internal2(infile)
    datamachine.print_bp_head(lst)
    datamachine.statistic(lst)
示例#4
0
def statistic(infile, automode=False):
    if not automode:
        size = os.path.getsize(infile)
        print('编排文件{0},共{1}字节\n'.format(infile, format(size,',')))
        infile = read_input(infile)
        if infile == None:
            return
          
    lst = datamachine.bp_to_internal2(infile)
    
    datamachine.print_bp_head(lst)
    datamachine.statistic(lst)
示例#5
0
def statistic(infile, automode=False):
    if not automode:
        size = os.path.getsize(infile)
        print('编排文件{0},共{1}字节\n'.format(infile, format(size,',')))
        infile = read_input(infile)
        if infile == None:
            return
          
    lst = datamachine.bp_to_internal2(infile)
    
    datamachine.print_bp_head(lst)
    datamachine.statistic(lst)
示例#6
0
文件: tz2txt.py 项目: zhufeng/tz2txt
def bp_process_bp(infile, outfile):
    # 文件大小
    size1 = os.path.getsize(infile)
    
    lst = datamachine.bp_to_internal2(infile)
    datamachine.print_bp_head(lst)
    lst = datamachine.process_internal2(lst)
    wrote = datamachine.internal2_to_bp(lst, outfile)

    if wrote:
        size2 = os.path.getsize(outfile)
        print('输入文件{0}字节,输出文件{1}字节'.format(format(size1,','),
                                                    format(size2,',')
                                                    )
              )