import sys
reload(sys)
#sys.setdefaultencoding("gbk")
file = open('PTYUPCHNATP_D0411_C7_Q0_N5.log')
f=open('PTYUPCHNATP_D0411_C7_Q0_N5.log.txt','w')
for line in file:
print line.decode('string_escape')
f.write(line.decode('string_escape'))
[AFA]/usr/afa/log/20190411/BPUB/TYUPCHNATP>cat aa
[10:53:43.479][26935350][I][输入的参数为:['1001', '20190411', '39167934', 'B01', '20190411', '105323', '10401020190411012423730138', '20190411105343478867', '1', '000000', 'xb3xc9xb9xa6', '20190411105343479584', '2019
[AFA]/usr/afa/log/20190411/BPUB/TYUPCHNATP>cat bb
cat: cannot open bb
[AFA]/usr/afa/log/20190411/BPUB/TYUPCHNATP>python ts.py
[10:53:43.479][26935350][I][输入的参数为:['1001', '20190411', '39167934', 'B01', '20190411', '105323', '10401020190411012423730138', '20190411105343478867', '1', '000000', '成功', '20190411105343479584', '2019
[AFA]/usr/afa/log/20190411/BPUB/TYUPCHNATP>cat bb
[10:53:43.479][26935350][I][输入的参数为:['1001', '20190411', '39167934', 'B01', '20190411', '105323', '10401020190411012423730138', '20190411105343478867', '1', '000000', '成功', '20190411105343479584', '2019
[AFA]/usr/afa/log/20190411/BPUB/TYUPCHNATP>python ts.py
[10:53:43.479][26935350][I][输入的参数为:['1001', '20190411', '39167934', 'B01', '20190411', '105323', '10401020190411012423730138', '20190411105343478867', '1', '000000', '成功', '20190411105343479584', '2019
[AFA]/usr/afa/log/20190411/BPUB/TYUPCHNATP>cat bb
[10:53:43.479][26935350][I][输入的参数为:['1001', '20190411', '39167934', 'B01', '20190411', '105323', '10401020190411012423730138', '20190411105343478867', '1', '000000', '成功', '20190411105343479584', '2019
[AFA]/usr/afa/log/20190411/BPUB/TYUPCHNATP>python ts.py
[10:53:43.479][26935350][I][输入的参数为:['1001', '20190411', '39167934', 'B01', '20190411', '105323', '10401020190411012423730138', '20190411105343478867', '1', '000000', '成功', '20190411105343479584', '2019