python 按行读取判断是否为空

 1         for line in fr.readlines():
 2             try:
 3                 # print(len(line))
 4                 if(len(line)==1):
 5                     continue
 6                 else:
 7                     fw.write(matcher1[0]+'_%s'%j+','+line)
 8                     j=j+1
 9             except:
10                 pass
原文地址:https://www.cnblogs.com/smuxiaolei/p/7449415.html