Python/개념학습
-
day01Python/개념학습 2022. 7. 25. 12:30
1. 배열에서도 string slicing 적용 가능 1 d = [7, 9, ['Myungseo', 'L3opold7']] cs 1 print(d[-1][0]) # 출력값 : Myungseo cs 2. 인덱스 지정해 값 변경 1 2 3 4 5 # List 연속된 값으로 변경 test = [1, 2, 3, 4, 5] test[2:3] = ['a', 'b', 'c'] print(test) # [1, 2, 'a', 'b', 'c', '4', '5'] 3.인덱스 요소 삭제 1 2 3 4 5 6 7 8 9 10 11 # 리스트 요소 삭제 방법 test = ['a', 'b', 'c', 'd', 'e'] # 1. test[2:4]=[] # test = ['a', 'b', 'e'] #2. del test [2:4] #..