| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 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 |
- docker
- Flask
- pandas
- format
- enV
- judge
- Windows
- numpy
- list
- DB
- Python
- Converting
- 책갈피
- Database
- PostgreSQL
- evaluation
- LLM
- Linux
- git
- Container
- file
- KAKAO
- pytorch
- Laravel
- AI
- Mac
- Paper
- Package
- TORCH
- GitLab
- Today
- Total
목록Python (36)
Daily Develope
의미 Type checking을 위해 데이터의 유형을 명시적으로 나타내기 위해 사용하는 Class (또는 Type) 자주 사용되는 Type Any : 모든 Type과 호환되는 Type Union : Union 리스트에 선언된 Type 중 하나에 해당함을 의미 def foo(arg: Union[int, float] = None) -> None: # arg는 int 또는 float 유형 # ... Optional : Optional 리스트에 선언된 Type이거나 None인 경우를 의미 def foo(arg: Optional[int] = None) -> None: # ... 가끔 사용되는 Type NoReturn : function의 반환값이 없음을 명시적으로 표현 from typing import NoRet..
Pickle이란? Python의 객체(Object)를 binary 파일로 serializing 하거나 반대로 binray 파일로부터 de-serializing 하기 위한 프로토콜이 구현된 라이브러리. 흔히 pickling, flattening, marshalling 등으로 일컫는다. 장점? Python 객체를 바로 파일로 쓰거나 읽을 수 있다. Binary(또는 Bytes) 형태로 데이터를 다루기 때문에 읽기/쓰기 속도가 빠르다. 읽기/쓰기 예시코드 import pickle import os my_filepath = "target/file/path/filename.bin" my_data = ['target', 'data'] if os.path.isfile(my_filepath): ### 읽기 with o..
환경Python 3.9.7- modules : psycopg2Postgresql (Container, version:alpine3.18)- host : 127.0.0.1- port : 5432- database : mydb- 컨테이너 배포 샘플코드Connection Classimport psycopg2import loggingclass DBBaseController: def __init__(self, host:str="127.0.0.1", port:int=5432) -> None: self.__connect(host=host, port=port) def __connect(self, host:str="127.0.0.1", port:int=5432): try: ..
방법 1. 내장 property method 클래스의 속성값에 대한 getter, setter, destructor 동작을 method로 정의하고, 내장함수인 property를 사용해 해당하는 속성과 연결시켜 사용. 샘플코드 # Python program showing a use of property() function class Geeks: def __init__(self): self._age = 0 # function to get value of _age def get_age(self): print("getter method called") return self._age # function to set value of _age def set_age(self, a): print("setter metho..