001、利用循环结构
[root@PC1 test01]# ls a.fa test.py [root@PC1 test01]# cat a.fa ## 测试DNA序列 GATGGAACTTGACTACGTAAATT [root@PC1 test01]# cat test.py ## 转换程序 #!/usr/bin/env python # -*- coding: utf-8 -*- in_file = open("a.fa", "r") str1 = "" for i in in_file: i = i.strip() for j in i: if j == "T": str1 += "U" else: str1 += j in_file.close() print(str1) [root@PC1 test01]# python test.py ## 转换结果 GAUGGAACUUGACUACGUAAAUU
002、
标签:DNA,python,RNA,PC1,##,test01,root,str1 From: https://www.cnblogs.com/liujiaxin2018/p/17659373.html