读取文件中的内容:
with open('data.txt','r') as f: data_list = f.readlines()#每一行是一个字符串 data_list = [i.strip(' ') for i in data_list]#去掉换行符 data_list = [i.split(',') for i in data_list]#每一行以逗号分隔字符 data = [(float(i[0]),float(i[1]),float(i[2])) for i in data_list]#将每一个字符变成float型