正在编辑中,稍后有时会重新提交 正在编辑中,稍后有时会重新提交 正在编辑中,稍后有时会重新提交
最佳答案
这应该有效:
import re #Regex may be the easiest way to split that line
with open(infile) as in_f, open(outfile,'w') as out_f:
f = (i for i in in_f if i.rstrip()) #iterate over non empty lines
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')
关于python - 拆分后与 Python 的缩进不一致,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6673917/