어제 배웠던 것
Sequence Type
파이썬에서 시퀀스 타입은 '열거형'이라는 의미에 가깝다
Lists, tuples, xrage object 또한 다른 언어들과 다르게 strings도 시퀀스 타입이다
참고) Python Standard Library : 파이썬 문법에 관한 내용들이 상세히 설명되어있다
1. List (형태 : 변수=["", "", ""...])
리스트에서 중요한 두 가지
1) 찾기 쉽다(common)
days="M, T, W, Th, F"라면 이중에 W를 찾는 것은 어렵다
days=["m", "t", "w", "th", "f"]라면 인덱스를 활용해 찾을 수 있다
인덱스는 번호표(?) 같은 느낌 컴퓨터라 0부터 시작한다
days [0]은 m days [1]은 t 이런 식이다
2) 값을 변경할 수 있다(mutable)
days=["m", "t", "w", "th", "f"]에서 s를 추가하고 싶을 경우
days.append("s")를 해주면 추가가 된다
https://docs.python.org/3/library/stdtypes.html#sequence-types-list-tuple-range
Built-in Types — Python 3.8.2 documentation
The following sections describe the standard types that are built into the interpreter. The principal built-in types are numerics, sequences, mappings, classes, instances and exceptions. Some collection classes are mutable. The methods that add, subtract,
docs.python.org
이곳에 어떤 기능이 되는지가 잘 나와있다
2.Tuple (형태 : 변수=("", "", ""...))
튜플의 중요한 두 가지
1) 찾을 수 있다 (common)
리스트와 동일
2) 변할 수 없다(unmutable)
직접 튜플 안의 내용을 바꾸지 않고는 변할 수 없다
3.Dictionary (형태 : 변수={"":"", "":""...})
딕셔너리의 중요한 두 가지
1) 찾을 수 있다
2) 변할 수 있다(mutable)
'무엇은 뭐이다' 이런 식으로 나타나서 보기가 좋다
'노마드코더스 아카데미 > 파이썬으로 웹스크래퍼 만들기' 카테고리의 다른 글
파이썬 웹스크래핑with nomad coders[5] (0) | 2020.03.05 |
---|---|
파이썬 웹스크래핑with nomad coders[4] (0) | 2020.03.05 |
파이썬 웹스크래핑with nomad coders[3] (0) | 2020.03.05 |
파이썬 웹스크래핑with nomad coders[1] (0) | 2020.03.01 |
파이썬 웹스크래핑with nomad coders (0) | 2020.03.01 |