Этот код возвращает следующее сообщение об ошибке:
-
с открытым (infile, mode = 'r', buffering = -1) как in_f, open (outfile, mode = 'w', buffering = -1) как out_f: TypeError: принуждение к Unicode: нужна строка или буфер, найденный файл
# Opens each file to read/modify infile=open('110331_HS1A_1_rtTA.result','r') outfile=open('2.txt','w') import re with open (infile, mode='r', buffering=-1) as in_f, open (outfile, mode='w', buffering=-1) as out_f: f = (i for i in in_f if i.rstrip()) for line in f: _, k = line.split('\t',1) x = re.findall(r'^1..100\t([+-])chr(\d+):(\d+)\.\.(\d+).+$',k) if not x: continue out_f.write(' '.join(x[0]) + '\n')
Пожалуйста, помогите мне.