CANDTU双通道合并记录的数据,如何将两通道的数据转换成一个CSV格式文件...
发布网友
发布时间:2024-01-18 06:49
我来回答
共1个回答
热心网友
时间:2024-07-30 18:59
使用 python list即可,因为list可以加入不同的数据类型的数据。
results = list()lines = open('cvs_file', 'r').readlines()for line in lines: elements = line.strip().split(',') # supposed limiter is ',' for e in elements: try: results.append(float(e)) except: continue# Here results will contains all splitted elements# all elements are string read from cvs file, so you need to# converse it with float operator. But if element is read string# we can catch conversion exception and throw it anyway.