懵懂的菜鸟

Stay hungry,Stay foolish.

导航

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

 

posted on 2017-08-29 17:33  懵懂的菜鸟  阅读(1118)  评论(0编辑  收藏  举报