일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- Windows
- CUDA
- PostgreSQL
- Database
- judge
- Flask
- numpy
- git
- pytorch
- Package
- Converting
- pandas
- Paper
- GitLab
- format
- Python
- enV
- docker
- evaluation
- TORCH
- Linux
- KAKAO
- LLM
- list
- Mac
- Container
- DB
- file
- Laravel
- AI
- Today
- Total
목록file (4)
Daily Develope
리스트 (List) List의 Item 한 줄씩 출력 my_list = ["line1", "line2", "line3"] print(f"{my_list}", sep="\n")List 간단한 명령 한 줄로 처리 ### 예) a 값이 None 인 경우를 제외하고 덧셈 값 반환 sample = [[1, 2], [3, 4], [None, 6]] sample = [a+b for a, b in sample if a != None] >> print(sample) [3, 7]List 의 index 및 값 순차출력 t_list = [1, 5, 7, 33, 39, 52] for tup in enumerate(t): print(tup) ### output (0, 1) (1, 5) (2, 7) (3, 33) (4, 39) (..
조건문 if / elif / else ### 예제) cmp_value가 1이면 1을 반환, 2면 2를 반환, 이 외에는 -1을 반환 cmp_value = "cond1" if cmp_value == "cond1": return 1 elif cmp_value == "cond2": return 2 else: return -1삼항연산자 (ternary operator) ### 예) cmp_value가 양수면 Ture, 음수면 False 반환 cmp_value = 5 isPositive = True if cmp_value >= 0 else False 반복문 While 반복문 ### 예) cnt 값이 10이 될 때까지 반복문 실행 cnt = 0 while cnt != 10: print(f"{cnt}") cnt+=1..
1 외부장치 연결 및 확인 외부저장매체가 연결된 드라이브 포트 확인 fdisk -l # 출력 예시 : /dev/sdbN/ 2 마운트 (앞선 과정에서 확인한) 드라이브 포트와 특정 폴더를 연결 # 폴더 생성 및 쓰기권한 부여 mkdir /tmp/mounted chmod 755 /tmp/mounted # 드라이브 포트와 생성한 폴더 연결 mount /dev/sdbN /tmp/mounted 3 복사 # 외부저장매체의 "target_file" 파일을 호스트의 /home dir 경로에 "copied_file" 이란 이름으로 복사 cp /tmp/mounted/target_file /home/copied_file 4 마운트 해제 사용이 끝난 외부저장장치를 연결된 드라이브 포트에서 제거 umount /dev/sdbN
ㅇ 폴더 및 파일 탐색 - 예) target_dir 에서 png, jpg 파일 출력 (non-recursion) target_dir = f'{os.getcwd()}/sample' for root, dirs, files in os.walk(target_dir): for file in files: if file.endswith(('.png', 'jpg')): print(file) ㅇ 파일 존재 확인 import pathlib if pathlib.Path('myfile.txt').exists(): print("exists")