Python系列脚本

来源:互联网 发布:淘宝店铺设置地址无效 编辑:程序博客网 时间:2024/06/05 09:16

今天看了点log,发现累的慌,写了个脚本解析一下过滤出来

import string
f=file('20160923_160206_F5AZCY04F095_logcat.txt')
w  = open('111.txt', "w") 
info='distance (x,y,x_pre,y_pre)'
lines=f.readlines()


s=')'
for line in lines:
  if line:  
pass    # do something here 
if line.find(info) != -1: 
#p=line[-7:]
u3 = line.split('=',2)
ss=u3[-1]
p=float(ss)
if p > 60.0:
pp=str(p)
w.writelines(pp)
#print line.split('=',2)
       # if m==(-1)
#z=p.replace(')','===================================================')
#m=z[1:]
#w.writelines(u3[-1])
#if m.find('=') == -1:
#p=float(m)
#if p > 60.0:
#w.writelines(str(p))
#w.writelines(m)


log如下

04-25 23:55:17.148   336   336 V AudioFlinger: openInput_l() created record thread: ID 22 thread 0xf0810008
04-25 23:55:17.149   336   336 V AudioFlinger: closeInput() 22
04-25 23:55:17.151   336  3393 I AudioFlinger: AudioFlinger's thread 0xf0810008 ready to run
04-25 23:55:17.151   336   336 D audio_hw_primary: adev_close_input_stream: enter:stream_handle(0xab3d0548)
04-25 23:55:17.152   336   336 D audio_hw_primary: in_standby: enter: stream (0xab3d0548) usecase(7: audio-record)
04-25 23:55:17.253   429     0 I Kernel  : <7>[  500.090658] wcd_check_cross_conn: leave, plug type: 1
04-25 23:55:17.253   429     0 I Kernel  : <6>[  500.299169] wcd_correct_swch_plug:result1 = 0, result2 = 0
04-25 23:55:17.253   429     0 I Kernel  : <7>[  500.303922] wcd_enable_curr_micbias: enter, cs_mb_en: 1
04-25 23:55:17.261   429     0 I Kernel  : <7>[  500.309253] wcd_program_btn_threshold: course: 1 fine: 0 reg_addr: 153 reg_val: 20
04-25 23:55:17.261  2423  2423 D Kevin   : onTouchEvent(x, y)=(39.944523, 338.9178)
04-25 23:55:17.262  2423  2423 D Kevin   : Line=0 , testedValue=39.944523 , upbond=106.0 , lowbond=0.0
04-25 23:55:17.262  2423  2423 E Kevin   : Stop point not in spec.
04-25 23:55:17.262  2423  2423 D Kevin   : (distance1 and distance2) < margin =(888.18 and 27.76) < 53.0
04-25 23:55:17.262  2423  2423 D Kevin   : (distance3 and distance4) < margin =(286.22 and 1150.15) < 53.0
04-25 23:55:17.263  2423  2423 D Kevin   : distance (x,y,x_pre,y_pre) = (39.944523,338.9178,39.944523,267.7908)=71.13


为了滤除这个71.13,毕竟是自己写的第一个python实用脚本,留作纪念

0 0
原创粉丝点击