1. List i번째 인자 제거
test = [5, 6, 7, 8]
del test[1]
print(test)
# [5, 7, 8]
2. List i번째 위치에 x 라는 데이터 삽입
test = [5, 6, 7, 8]
test.insert(1, 9)
print(test)
# [5, 9, 6, 7, 8]
3. List x 라는 데이터 삭제
test = [5, 6, 7, 8]
test.remove(7)
print(test)
# [5, 6, 8]
'Development > Python' 카테고리의 다른 글
[Solved][Python3.7] ValueError: incomplete format (0) | 2020.03.31 |
---|---|
[Solved][Python3] ModuleNotFoundError: No module named 'dateutil' (0) | 2020.03.29 |
[Solved][Python] TypeError: 'NoneType' object is not subscriptable (0) | 2020.03.17 |
[Python][requests] GET & POST with data, params, headers, cookies 예시 (0) | 2020.03.14 |
[프로그래머스][Python3] 해시 - 완주하지 못한 선수 모범답안 (0) | 2020.03.08 |