본문 바로가기

전체 글95

[JS] Date를 이용한 날짜 및 요일 구하기 function get_date() {    let year = ""    let month = ""    let day = ""    let weekday = ""    const WEEKDAY = ['일요일', '월요일', '화요일', '수요일', '목요일', '금요일', '토요일']    let current_date = new Date();    year = String(current_date.getFullYear());    month = String(current_date.getMonth() + 1);    day = String(current_date.getDate());    weekday = WEEKDAY[current_date.getDay()]    return year + "년 " +.. 2024. 5. 27.
[python] 디렉토리 관련 명령어 >>> import os# 현재 작업하고 있는 경로>>> os.getcwd()# path 경로에 있는 파일 및 폴더 목록 리스트화(매개변수가 없는 경우 현재 실행하고 있는 위치의 파일 목록 보여줌)os.listdir([path])# file의 이름과 확장자를 tuple형태로 나타냄os.path.splitext(file>)  사용 예시 >>> import os# 현재 작업하고 있는 경로>>> os.getcwd()'/Users/nahkim/Documents/GitHub/TIL'# path 경로에 있는 파일 및 폴더 목록 리스트화(매개변수가 없는 경우 현재 실행하고 있는 위치의 파일 목록 보여줌)>>> os.listdir()['batch.log', 'Tutorial', 'docs', 'test.py', 'RE.. 2024. 5. 27.
poetry peotry이란? 파이썬에서 의존성 관리 및 패키징을 위한 도구 시스템 요구사항 : 파이썬 3.7 이상 특징 build/publish 지원 가상환경(virtualenv)을 자체적으로 관리 설치 및 기본적인 사용법 설치 방법 리눅스, macOS, WSL curl -sSL https://install.python-poetry.org | python3 - 만약 오류가 날 경우 Exception: This build of python cannot create venvs without using symlinks brew install poetry 설치 확인 poetry --version 기본적인 사용법 방법 1. 프로젝트를 설정한다. poetry new [프로젝트명] 그 후 pyproject.toml파일에서 수정.. 2023. 6. 3.
[Java] 상속 관련 상속 캐스팅(casting) : 타입 변환 업캐스팅 (upcasting) 다운캐스팅 (downcasting) 업캐스팅(upcasting) : 서브 클래스의 객체에 대한 레퍼런스를 슈퍼 클래스 타입으로 변환하는 것 업캐스팅은 슈퍼 클래스의 레퍼런스로 서브클래스의 객체를 가리키게 한다. Person p; Student s = new Student(); p = s; // 업캐스팅 업캐스팅한 레퍼런스로는 객체 내에 모든 멤버에 접근할 수 없고 슈퍼 클래스의 멤버만 접근할 수 있다. 다운캐스팅(downcasting) : 업캐스팅과 반대로 캐스팅하는 것 instanceof 연산자 업캐스팅을 한 경우, 레퍼런스가 가리키는 객체의 진짜 클래스 타입을 구분하기 어려움 → instanceof 연산자 사용 메소드 오버라이딩.. 2023. 5. 30.