## 源码( delBlank.py )
import sys,os
def readLines(fname):
with open(fname,"r") as file:
return file.readlines()
lines = readLines(sys.argv[1])
for line in lines:
if len(line.strip()) != 0:
print line,
1. delBlank.py code.txt > tmp.txt
将code.txt中存在空行的代码全部清理掉,然后全部导出到tmp.txt之中。
2. 应用场景
当进行代码行数统计、或是要求编写软件说明书的doc版时需要进行处理。