2020
09-27
09-27
基于python实现对文件进行切分行
针对配置文件进行切分,重组,每隔30行为一段,进行重新生成功能。代码如下#!/usr/local/python/bin/python#coding=utf-8importsysimportreimportosf=open('config.conf','r')#判断文件条数deffile_num(filename):num_col=0withopen(filename,'rb')asFnum:while(Fnum.readline()!=''):num_col=num_col+1returnnum_colfile_num=file_num('config.conf')print'文件总条数:'+str(file_num)i...
继续阅读 >