python怎样将txt里的数据提取成为一个数组

0.000000626435
0.000000615123
0.000000624883
0.000000613808
0.000000623549
0.000000632929
0.000000621124
0.000000630659
0.000000619206
0.000000628830
0.000000617510
0.000000627243
0.000000615872
0.000000625418
0.000000614111
0.000000623443
0.000000632783
0.000000621305
一行一行的txt文件 提取成为一个数组
[0.000000626435 0.000000615123 0.000000624883
0.000000623549 0.000000621124]
类似于这样的数据

def read_data_from_txt(file_name):
    with open(file_name, 'r') as fp:
        return [float(line.strip()) for line in fp.readlines()]

你好,用pandas直接导入

import pandas as pd
a = pd.read_csv('exam.txt')#exam.txt是你自己的txt文档名字,自己可以改动
list(a.iloc[:,0])#假如需要变成list就用这行