Using latest numpy (1.14) on Py3.
Your sample, cleaned up:
In [93]: txt = """Name --- Class --- Numbers
...: a ---------- 1 -------- 3
...: b ---------- 2 -------- 4
...: c ---------- 3 -------- 2
...: a ---------- 1 -------- 3
...: b ---------- 2 ------- 1
...: c ---------- 3 --------- 2"""
In [94]: data = np.genfromtxt(txt.splitlines(), dtype=None, names=True, encoding=None)
In [95]: data
Out[95]:
array([('a', '----------', 1, '--------', 3),
('b', '----------', 2, '--------', 4),
('c', '----------', 3, '--------', 2),
('a', '----------', 1, '--------', 3),
('b', '----------', 2, '-------', 1),
('c', '----------', 3, '---------', 2)],
dtype=[('Name', '<U1'), ('f0', '<U10'), ('Class', '<i8'), ('f1', '<U9'), ('Numbers', '<i8')])
Or skipping the dashed columns:
In [96]: data = np.genfromtxt(txt.splitlines(), dtype=None, names=True, encoding=None, usecols=[0,2,4])
In [97]: data
Out[97]:
array([('a', 1, 3),
('b', 2, 4),
('c', 3, 2),
('a', 1, 3),
('b', 2, 1),
('c', 3, 2)],
dtype=[('Name', '<U1'), ('Class', '<i8'), ('Numbers', '<i8')])
--- 1and others no space---2. That could give any reader problems.genfromtxtaccepts column numbers as thedelimiterparameter.genfromtxteasily creates a structured from a csv file.