일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- JaCoCo
- Code-coverage
- javascript
- primitive type
- API
- python
- 인프런
- ECMAScript2015
- RESTful
- Linux
- GIT
- sanghaklee
- sinopia
- Unit-test
- ubuntu
- Lodash
- ATOM
- dict
- nginx
- 개인정보수정
- Coveralls
- node.js
- PowerMock
- NPM
- java
- AWS
- Gitbook
- REST
- {}
- Travis CI
- Today
- Total
목록dict (2)
이상학의 개발블로그

python dict default value when you access item 파이썬에서 자바스크립의 Object(객체)와 유사한 자료형은 Dictionary(딕셔너리)다. dict = { 'name': 'hak' } dict.get('name') # 'hak' dict.get('age') # '' dict.get('age', 30) # 30 dict.get('age') or 30 # 30 .get() 메소드의 두번째 파라미터에 기본 값을 줄 수 있다. 두번째 파라미터의 디폴트는 None이고, 디폴트 값이 있기 때문에 KeyError는 발생하지 않는다. or 연사자를 이용해 딕셔너리의 ..

python how to remove duplicate dict in list https://stackoverflow.com/questions/11092511/python-list-of-unique-dictionaries dict 전체 중복 # 순서가 보장되지 않음 list(map(dict, set(tuple(sorted(d.items())) for d in data))) # 순서가 보장됨 list(map(dict, collections.OrderedDict.fromkeys(tuple(sorted(d.items())) for d in data))) data = [ {'id': 1, 'name': 'hak', 'age': 30}, {'id&#..