按照视频敲的啊,为什么会报错呢
def save_file(boy,girl,count):file_name_boy = 'boy_'+str(count)+'.txt'
file_name_girl = 'girl_'+str(count)+'.txt'
boy_file = open(file_name_boy,'w')
girl_file = open(file_name_girl,'w')
boy_file.writelines(boy)
girl_file.writelines(girl)
boy_file.close()
girl_file.close()
def split_file (file_name):
f = open("record.txt")
boy=[]
girl=[]
count=1
for each in f:
if each[:6] != "======":
#进行字符串分割
(role,line_spoken)= each.split(':',1)
if role == "小甲鱼":
boy.append
if role =="小客服":
girl.append
else:
save_file(boy,girl,count)
boy = []
girl = []
count+=1
save_file(boy,girl,count)
f.close()
spilt_file("record.txt")
报了什么错?是不是txt文档编码格式的问题?这一题很多因为这个 希望能学会正确提问
页:
[1]