[Python] List 와 Tuple에 대하여 (indexing, slicing, dictionary, split) (list와 tuple 차이)
List 인덱싱하기 (indexing) thislist = ["apple","banana","cherry"] thislist[0] = "blackcurrant" #대입 리스트에 다음과 같이 값을 대입 할 수 있다. List 자르기 (slicing) thislist = ["apple","banana","cherry","orange", "kiwi", "melon", "mango"] thislist[2:5] #마지막 번호는 포함되지 않음 thislist[:4] #0번은 생략가능 thislist[2:] #마지막 번호는 생략가능 앞 데이터 순으로 0, 1, 2 순으로 시작된다 원하는 값을 추출하기 위해 list [2,5] 이런 식으로 데이터를 자를 수 있다 앞부분은, 뒷부분은 생략해서 [ : 4] [ 4 : ] ..
2022. 10. 24.