例题2.2

例题2.1代码

import numpy as np
a = []
with open('F:\python数学建模与算法\第二章例题\data2_2.txt') as f:
    for (i, s) in enumerate(f):
        a.append([s.count('a'), s.count('c'), s.count('g'),s.count('t')])
b = np.array(a); print(b)


posted @ 2024-10-22 19:04  等我刷把宗师  阅读(12)  评论(0)    收藏  举报