티스토리 뷰
getattr
(object, name[, default])Return the value of the named attribute of object. name must be a string. If the string is the name of one of the object’s attributes, the result is the value of that attribute. For example, getattr(x,'foobar')
is equivalent to x.foobar
. If the named attribute does not exist, default is returned if provided, otherwise AttributeError
is raised.
rsplit
>>> '----a---b--c-'.rsplit('-') ['', '', '', '', 'a', '', '', 'b', '', 'c', ''] >>> '----a---b--c-'.rsplit('-', 1) ['----a---b--c', ''] >>> '----a---b--c-'.rsplit('-', 2) ['----a---b-', 'c', ''] >>> '----a---b--c-'.rsplit('-', 3) ['----a---b', '', 'c', ''] >>> '----a---b--c-'.rsplit('-', 4) ['----a--', 'b', '', 'c', ''] >>> '----a---b--c-'.rsplit('-', 5) ['----a-', '', 'b', '', 'c', ''] >>> '----a---b--c-'.rsplit('-', 6) ['----a', '', '', 'b', '', 'c', '']
참조: https://docs.python.org/3/library/functions.html#getattr
'BackEnd > Python' 카테고리의 다른 글
[퍼옴] 나만의 파이썬 패키지를 작성하는 법 (0) | 2018.03.22 |
---|---|
[퍼옴] Python __str__, __repr__ 의 차이점 (0) | 2018.02.25 |
[퍼옴] @staticmethod, @classmethod 차이 (0) | 2018.02.01 |
python에서 private로 처리 하고 싶다면? @Property (0) | 2018.01.31 |
[퍼옴] Python *, ** 의미? (0) | 2018.01.30 |
댓글
공지사항
최근에 올라온 글
링크
TAG
- mysql
- Gradle
- 모두의딥러닝
- mybatis
- 파이썬
- Maven
- tensorflow
- Java
- BigData
- 중앙정보처리학원
- serverless
- AI
- AWS
- 점프투파이썬
- 텐서플로우
- 머신러닝
- spark
- Configuration
- web
- python
- API
- executor
- TDD
- ML
- Docker
- spring
- Error
- javascript
- memory
- NIO
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
글 보관함