我想打开并绘制* .dat文件,但当我强迫Python执行我的梦想时;)它会抛出:
Traceback (most recent call last):
File "panel_plot.py", line 10, in <module>
x, y = np.loadtxt(file_name, dtype=float, delimiter='\t', unpack=True, skiprows=1)
File "/usr/lib/python2.7/dist-packages/numpy/lib/npyio.py", line 848, in loadtxt
items = [conv(val) for (conv, val) in zip(converters, vals)]
ValueError: invalid literal for float(): 1.000000 0.001260
我的程序部分负责读取.dat文件:
with open ('naca0012.dat') as file_name: x, y = np.loadtxt(file_name, dtype=float, delimiter='\t', unpack=True, skiprows=1)
稍后在程序中将这些坐标写入一个数组,我将需要绘制几何图形。谢谢你的帮助!
祝你好运 莱纳斯