切割sdf

def split_sdf(sdf_file_path):
    txt = Path(sdf_file_path).read_text()
    sdf_list=[]
    lines=[]
    for line in txt.splitlines():
        lines.append(line)
        if line=='$$$$':
            if len(sdf_list)>1:
                while sdf_list[0]=='' or sdf_list[0].isspace():
                    sdf_list=sdf_list[1:]
            sdf_list.append('\n'.join(lines))
            lines=[]
    return sdf_list

你可能感兴趣的:(生物信息学)