标签:with def line condition rip for false 文本 note
def split_docs(lines, separator): """ :note: The English sentence is in the front, the Chinese sentence is in the back, and the two are separated by a separator. """ if not lines: return [], [] eng_lines = [] chn_lines = [] chn_begin_condition = False for line in lines: if chn_begin_condition: chn_lines.append(line) else: chn_begin_condition = line.lstrip().startswith(separator) if not chn_begin_condition: eng_lines.append(line) return eng_lines, chn_lines
标签:with def line condition rip for false 文本 note
原文地址:https://www.cnblogs.com/wenlin-gk/p/10694977.html