[Python] 리스트 메서드
# 리스트 데이터 삭제하는 방법 fruits = ['apple','orange','mango'] fruits.pop() # mango print(fruits) ['apple','orange'] # 리스트 데이터 삭제하는 방법(인덱스 이용) fruits = ['apple','orange','mango'] fruits.pop(0) # apple # 리스트 데이터 삭제하는 방법(데이터 이용) fruits = ['apple','orange','mango'] fruits.remove('orange') print(fruits) # ['apple','mango'] # 리스트 특정 값의 인덱스 구하는 방법 fruits = ['apple','orange','mango'] fruits.index('orange') # 1 ..
Python
2022. 6. 8. 01:08