我想导入一个.dat文件,其中包括
lines/header/numbers/lines
Run Code Online (Sandbox Code Playgroud)
像这个例子
start using data to calculate something
x y z g h
1 4 6 8 3
4 5 6 8 9
2 3 6 8 5
end the data that I should import.
Run Code Online (Sandbox Code Playgroud)
现在我正在尝试读取此文件,删除第一行和最后一行并将数字放入数组中并对其进行一些基本计算,但我无法摆脱这些行。我曾经data = np.genfromtxt('sample.dat')导入数据,但是有了线,我什么也做不了。谁能帮我?
在Python 3中是否可以访问此列表初始化中的列表元素?我想,这是不可能的,但我对它的情况感兴趣.
例如,像这样:
lst = [0, 1, 2, 3] + lst[0]
Run Code Online (Sandbox Code Playgroud)
要么
lst = [0, 1, 2, 3, lst[0]]
Run Code Online (Sandbox Code Playgroud)
先感谢您!