1
2
三
四
五
六
七
八
九
10
11
12
13
14
15
def delblankline(內場、外場):
"""刪除文件中的空白行"""
infp = open(infile," r")o
utfp = open(outfile,“w”)
lines = infp.readlines()
對李的臺詞是:
if li.split():
outfp.writelines(李)
infp.close()
outfp.close()
#呼叫示例
如果
__name__ == "__main__ ":
delblankline("1.txt "," 2.txt ")