Notice
Recent Posts
Recent Comments
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 | 29 |
30 | 31 |
Tags
- python
- Oracle SQL
- 보안뉴스 한줄요약
- 자바스크립트 element api
- 자바스크립트 jQuery
- 자바스크립트 API
- 자바스크립트
- 보안뉴스요약
- 자바스크립트 기본 문법
- 보안뉴스
- oracle
- php
- 카카오프로젝트
- 카카오프로젝트100
- oracle db
- 깃허브
- 다크웹
- javascript
- 자바스크립트 node
- 랜섬웨어
- 자바스크립트 prototype
- 오라클
- 보안뉴스한줄요약
- 카카오프로젝트 100
- 자바스크립트 객체
- numpy
- 보안뉴스 요약
- GIT
- ES6
- 파이썬
Archives
- Today
- Total
목록python getter setter (1)
FU11M00N

클래스에서 메서드를 통하여 속성의 값을 가져오거나 저장하는 경우가 있음 • 이 때 값을 가져오는 메서드를 getter() • 값을 저장하는 메서드를 setter() @property 데코레이터를 사용해서 getter, setter를 간단하게 구현 • @progerty 데코레이터 - 값을 가져오는 메소드 @메소드이름.setter 데코레이터 - 값을 저장하는 메소드 class Person(): def __init__(self): self.__age =0 @property def age(self): return self.__age @age.setter def age(self,value): self.__age =value james = Person() james.age = 20 print(james.age)..
Programming/Python
2020. 11. 24. 15:43