collections - Container datatypes 에서 딕셔너리 서브클래스 3개를 살펴보겠습니다. 일반적인 딕셔너리랑 다르게 조금 특별한 점이 있습니다. [1] defaultdict 딕셔너리에서 존재하지 않는 키를 조회할 경우 KeyError exception이 납니다. 하지만 defaultdict은 존재하지 않는 키를 조회하면 에러가 나는 것이 아니라 설정한 디폴트 값을 기준으로 해당 키에 대한 아이템을 딕셔너리에 추가해줍니다. defaultdict의 first argument로 default_factory 를 제공해주면 됩니다. 디폴트값을 10이라고 해줄게요! '라이언' 이라는 키값이 존재하지 않지만 KeyError도 안나고 디폴트 값을 기준으로 아이템을 딕셔너리에 추가해주는 것을 볼 수 ..
파이썬은 string formatting을 다양한 방식으로 지원해왔습니다. 1) %-formatting name = 'Fred' age = 50 introduce = 'My name is %s, my age next year is %s' % (name, age+1) print(introduce) // 결과 My name is Fred, my age next year is 51 2) str.format name = 'Fred' age = 50 introduce = 'My name is {}, my age next year is {}'.format(name, age+1) print(introduce) // 결과 My name is Fred, my age next year is 51 3) string.Temp..
[1] List Comprehension PEP 202 - List Comprehensions PEP 202 -- List Comprehensions The official home of the Python Programming Language www.python.org List Comprehension은 기존 리스트를 기반으로 새로운 리스트를 만들어내는 구문입니다. 예를들어 leading and trailing whitespaces를 지워주는 strip을 리스트의 모든 아이템에 적용하고 싶다면 이렇게 리스트 컴프리헨션을 이용할 수 있습니다. list = ["죠르디 ", " 라이언 "] new_list = [item.strip() for item in list] print(new_list) // 결과 [..
[ 단축어 만들고 싶은 이유 ] 깃헙 > Setting > Options에 보면 머지될 때 해당 브랜치를 지워주는 기능을 설정할 수 있습니다. 이는 원격 브랜치를 지워주는 기능으로 로컬 브랜치는 알아서 지워줘야합니다. 머지된 로컬 브랜치를 파악해서 스스로 지워주는 일이 귀찮을 때, 머지된 로컬 브랜치를 전부 지워주는 git 명령어를 쓸 수 있습니다. (새로운 로컬브랜치나 아직 머지되지 않은 로컬브랜치는 안지움) develop에 머지된 로컬 브랜치들을 삭제해주는 명령어입니다. (참고: local/remote/merged 브랜치 목록 조회 명령어) git branch -d $(git branch --merge develop | grep -i -v -E "master|develop") 주기적으로 이 명령어를 ..
[ 브랜치 목록 조회 ] master에서 develop, feature1, feature2 브랜치를 만들고 feature2 브랜치만 빼고 원격에 올려준 상태에서 진행하겠습니다. 1. local 브랜치 목록 조회 (with no flag) git branch 2. remote 브랜치 목록 조회 (with remote flag) git branch -r 3. 모든 브랜치(로컬 + 원격) 목록 조회 (with all flag) git branch -a [ 머지된 브랜치 목록 조회 ] feature1을 develop에 머지한 상황입니다. develop에 머지된 브랜치 목록을 조회할 때 git branch --merged develop feature2에 머지된 브랜치 목록을 조회할 때 git branch --me..
- Total
- Today
- Yesterday
- flutter 앱 출시
- METAL
- SerializerMethodField
- DRF APIException
- flutter deep link
- drf custom error
- Flutter Clipboard
- 구글 Geocoding API
- flutter build mode
- Sketch 누끼
- 플러터 싱글톤
- Flutter Spacer
- ribs
- 장고 Custom Management Command
- Watch App for iOS App vs Watch App
- Django FCM
- ipad multitasking
- cocoapod
- Flutter Text Gradient
- Dart Factory
- 장고 URL querystring
- github actions
- flutter dynamic link
- Flutter 로딩
- 플러터 얼럿
- Flutter getter setter
- Django Heroku Scheduler
- PencilKit
- Django Firebase Cloud Messaging
- Python Type Hint
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |