Python
-
[Django] vsc settings.json 설정Python/Django 2022. 1. 16. 02:11
{ "python.linting.pylintEnabled": false, "python.linting.enabled": true, "python.linting.flake8Enabled": true, "python.linting.lintOnSave": true, "python.formatting.provider": "black", "editor.formatOnSave": true, "python.linting.flake8Args": ["--max-line-length-88"], "python.pythonPath": "/Users/insub/.local/share/virtualenvs/AirBnB-9i5-lTwW/bin/python", "python.languageServer": "Pylance", "fil..
-
[Python] 소수를 표현하는 방법들 int, float() 와 decimal()Python 2022. 1. 12. 17:20
참고자료 Float vs Decimal in Python | LAAC Technology Learn the differences between floats and decimals in Python, common issues, and when to use each. www.laac.dev 코딩교육 티씨피스쿨 4차산업혁명, 코딩교육, 소프트웨어교육, 코딩기초, SW코딩, 기초코딩부터 자바 파이썬 등 tcpschool.com
-
[Python] iterable을 합쳐보자 itertools.chain()Python 2022. 1. 10. 13:37
iterable한 타입은 다 합칠수 있다 밑에 두개의 결과값은 같다
-
[Python] 비동기 처리를 해보자Python 2022. 1. 10. 10:58
참고 asyncio — 비동기 I/O — Python 3.10.1 문서 docs.python.org asyncio 파이썬 3.5이상에서는 Coroutine을 좀 더 계획적이고 더 나은 환경을 제공한다. 파이썬에 내장된 asyncio 패키지를 사용하는 것이다. velog.io 파이썬 코딩 도장: 47.10 asyncio 사용하기 asyncio(Asynchronous I/O)는 비동기 프로그래밍을 위한 모듈이며 CPU 작업과 I/O를 병렬로 처리하게 해줍니다. 동기(synchronous) 처리는 특정 작업이 끝나면 다음 작업을 처리하는 순차처리 방식이고, 비동 dojang.io 사용 예시 나의 코드에서 응용
-
[Django] login user와 요청 user validate 해주기 (DetailView)Python/Django 2021. 12. 28. 23:32
class UserProfileView(DetailView): model = users_models.User template_name = "users/profile/profile.html" context_object_name = "user_obj" #dispatch override def dispatch(self, request, pk): # 현재 유저 user_pk = request.user.pk # url query로 받아온 유저 pk url_pk = pk # 만약 둘이 일치 한다면 if user_pk is url_pk: return super(UserProfileView, self).dispatch(request) # if에서 걸러지지 못한다면 에러 메시지 띄우고 redirect messages.e..
-
[Python]Design Patterns in PythonPython/Python-Design-Patterns 2021. 12. 23. 17:57
https://refactoring.guru/design-patterns/python Design Patterns in Python Turns a request into a stand-alone object that contains all information about the request. This transformation lets you pass requests as a method arguments, delay or queue a request's execution, and support undoable operations. refactoring.guru