|
Python 替换字符串里的部分内容
例如 NM_66789.4,去掉后面的.4,只保留前面部分
#!/usr/bin/python
f=open('gene_id.txt')
f1=f.readlines()
new=[]
for i in f1:
b=i.split('.')
new.append(b[0])
new=[j+'n' for j in new]
myfile=open("2.txt","w")
myfile.writelines(new)
print new
Archiver|手机版|科学网 ( 京ICP备07017567号-12 )
GMT+8, 2024-9-27 07:06
Powered by ScienceNet.cn
Copyright © 2007- 中国科学报社