목록 이해력 사용 :
[((eegFilter(i)/sens)+25).reshape(1, *i.shape) for i in db]
데모:
In [12]: db = [np.arange(10).reshape(2, 5), np.arange(12).reshape(3, 4)]
In [13]: [(x%2).reshape(1, *x.shape) for x in db]
Out[13]:
[array([[[0, 1, 0, 1, 0],
[1, 0, 1, 0, 1]]]),
array([[[0, 1, 0, 1],
[0, 1, 0, 1],
[0, 1, 0, 1]]])]
출처
https://stackoverflow.com/questions/22005783