1.单个文件数据清洗
import ref=open("/Users/mingai/Downloads/4l8hA-1155-38.69.pdb","r")lines=f.readlines()f = open(‘/Users/mingai/Downloads/4l8hA-1155-38.69.txt‘,‘w‘)ans=[]patt = ‘-?\d+\.\d+‘for raw in lines: list = [] while(re.search(patt,raw)): c1 = re.search(patt, raw).group() list.append(c1) raw=raw.replace(c1,"",1) if list != []: ans.append(list[:3])for i in ans: if i != []: f.write(str(i))f.close()
原文地址:https://www.cnblogs.com/Marigolci/p/11739217.html
时间: 2024-11-04 16:28:33