#用strip(),split()两个方法都可以判断空行 infile=open('/.../','r') outfile=open('/.../','w') for li in infile.readlines(): if li.split(): #if li.strip(): outfile.writelines(li) infile.close() outfile.close()
#用strip(),split()两个方法都可以判断空行 infile=open('/.../','r') outfile=open('/.../','w') for li in infile.readlines(): if li.split(): #if li.strip(): outfile.writelines(li) infile.close() outfile.close()
|