标签:one open spl down arc nes lis lines end
1.单个文件数据清洗
import re
f=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()
标签:one open spl down arc nes lis lines end
原文地址:https://www.cnblogs.com/Marigolci/p/11739217.html