以下示例显示了我想要执行的操作:
>>> test
rec.array([(0, 0, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0),
(0, 0, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0)],
dtype=[('ifAction', '|i1'), ('ifDocu', '|i1'), ('ifComedy', '|i1')])
>>> test[['ifAction', 'ifDocu']][0]
(0, 0)
>>> test[['ifAction', 'ifDocu']][0] = (1,1)
>>> test[['ifAction', 'ifDocu']][0]
(0, 0)
Run Code Online (Sandbox Code Playgroud)
所以,我想给赋值(1,1)来test[['ifAction', 'ifDocu']][0].(最后,我想做类似的事情test[['ifAction', 'ifDocu']][0:10] = (1,1),为for分配相同的值0:10.我尝试了很多方法,但从未成功.有没有办法做到这一点?
谢谢你,Joon