0
Quizs time.How to insert a element into a embeded list using insert method or other methed relevant?
transfer a=[1,[2,3]] to b=[1,[2,3,4]] is insert method still helpful? a[1].insert() would work,but it is not very useful in a loop definition. Is there a more simple “insert” way like a.insert([1][2],4) existed?
1 Réponse
- 1
a=[1, [2, 3], 6]
a.insert( [10, 8] ,1)
print (a)
>>> [1, [10, 8], [2, 3], 6]
a[2].insert(90, 1)
print (a)
>>>[1, [10, 8], [2, 6, 3], 6]
let me know if it helped...