Python 3

list.insert(index, 값)

Coding_SJ 2020. 3. 18. 02:52

insert는 list에 중간에 꼽사리 껴넣는 용도로 쓰기 정말좋다.

 

>>> a = [1, 2, 3]

>>> a.insert(1, 5)

>>> a [1, 5, 2, 3]

[1, 5, 2, 3]