590
社区成员
发帖
与我相关
我的任务
分享
# -*- coding: cp936 -*-
count = 0
sa = 0
stra = '';
def func():
global count
global sa;
global stra;
if count == 6:
sa = sa+1;
#print 'sa' + str(sa) + 'count' + str(count);
count = 0;
stra = '\n'
else:
stra = ''
fh = open('F:\\wwb\\python\\other.txt');
fw = open('F:\\wwb\\python\\other_new.txt','a+');
for lh in fh.readlines():
#print "==" + stra + "==" + stra + "==" + lh
ss = lh.split(':');
if(lh.startswith('F_XM:')):
count = count + 1
func();
#left, sep, right = lh.partition('F_XM:');
fw.writelines('姓名 : ' + ss[1] + stra);
continue;
if(lh.startswith('F_DZYJ:')):
count = count + 1
func();
#left, sep, right = lh.partition('F_DZYJ:');
fw.writelines('邮箱 : ' + ss[1] + stra);
continue;
if(lh.startswith('F_FJ:')):
count = count + 1
func();
#left, sep, right = lh.partition('F_FJ:');
fw.writelines('分机 : ' + ss[1] + stra);
continue;
if(lh.startswith('F_SJ:')):
count = count + 1
func();
#left, sep, right = lh.partition('F_SJ:');
fw.writelines('手机 : ' + ss[1] + stra);
continue;
if(lh.startswith('F_GH:')):
count = count + 1
func();
#left, sep, right = lh.partition('F_GH:');
fw.writelines('工号 : ' + ss[1] + stra);
continue;
if(lh.startswith('F_XMPY:')):
count = count + 1
func();
#left, sep, right = lh.partition('F_XMPY:');
fw.writelines('拼音 : ' + ss[1] + stra);
continue;
fh.close();
fw.close();