- Python에 여러가지 method를 소개한다.
string, float, list 등 어떤 type이던지 모두 object 인데 method는 object에 적용된다.

- list method
- list에 .index() 를 해주면 해당 내용에 있는 index번호를 출력한다.
- .count()를 해주면 그 리스트에 해당 내용이 몇개있는지 출력한다.

- str method
- .capitalize() 를 해주면 string에 첫번째 문자를 대문자로 출력한다.
- .replace("a", "b") 일때 a 를 b로 변경한다.

- .append() 를 해주면 기존에 있는 리스트에 내용을 추가할 수 있다.

- 연습
- .reverse() method는 사용할때 () 안에 어떤 값도 넣지 않는다. 저렇게 되면 areas 의 리스트에 있는 값들을 뒤에서 부터 출력한다.


- 연습
- package import

슬라이드 출처 : Datacamp - Datascientist with python
'👩🏻💻 DataScientist for Python > DataCamp' 카테고리의 다른 글
| Introduction to Python 6 - 2D NumPy Arrays (0) | 2022.09.13 |
|---|---|
| Introduction to Python 5 - Numpy (0) | 2022.09.13 |
| Introduction to Python 3 - Function (0) | 2022.09.12 |
| Introduction to Python 2 - Manipulating List (0) | 2022.09.12 |
| Introduction to Python 2 - List (0) | 2022.08.31 |