+ 1

How to fix this problem?

--------------------------------------------------------------------------- IndexError Traceback (most recent call last) <ipython-input-24-74bdaa34e63b> in <module> 1 r=[[None]*20] ----> 2 r[1] = "180110_SJH_EEG.bdf" 3 raw[1] = mne.io.read_raw(r[1], preload=True) 4 r[2]="171102_KCY_EEG.bdf" 5 raw[2] = mne.io.read_raw(r[2], preload=True) IndexError: list assignment index out of range

31st May 2021, 6:10 PM
Zhenis Otarbay
Zhenis Otarbay - avatar
1 Réponse
+ 4
Change line 1 from r=[[None]*20] to r = [[None] for _ in range(20)] or r = [None]*20 r=[[None]*20] Is [[None, None, None,...]] Not [[None], [None], [None],...]
31st May 2021, 6:42 PM
ChaoticDawg
ChaoticDawg - avatar