import codecs
filecp = codecs.open('sunspot.dat', encoding ='utf-8')
file_data = np.loadtxt(filecp, usecols=(0,1),skiprows=1)
x = file_data[:,0]
y = file_data[:,1]
Python读取txt文件中的两列数据(无title)
最新推荐文章于 2022-08-09 16:17:35 发布
import codecs
filecp = codecs.open('sunspot.dat', encoding ='utf-8')
file_data = np.loadtxt(filecp, usecols=(0,1),skiprows=1)
x = file_data[:,0]
y = file_data[:,1]