Notice
Recent Posts
Recent Comments
Link
| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 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 |
Tags
- qwen3-coder-next
- docker
- podman compose
- Java
- jsonl
- Docker Compose
- Webpack
- io
- podman
- PowerShell
- Vite
- k3s
- json
- cli
- 이미지
- Thinking Mode
- json schema
- getting started
- RandomAccessFile
- ndjson
- Ollama
- vscode
- sys.path
- yaml
- curl
- tauri
- Typescript
- glm-ocr
- vim
- .dockerignore
Archives
- Today
- Total
목록sys.path (1)
워로디스
Python sys.path 를 사용해서 특정 경로 파일 임포트
아래처럼 사용자 파일이 있는 폴더 경로를 sys.path에 추가하면, 그 폴더 안의 .py 파일을 일반 모듈처럼 import할 수 있습니다.예시 폴더 구조:my_project/├─ main.py└─ user_files/ └─ my_module.pyuser_files/my_module.pydef hello(name): return f"Hello, {name}!"main.pyimport sysfrom pathlib import Path# 현재 파일(main.py)이 있는 폴더BASE_DIR = Path(__file__).resolve().parent# 사용자가 만든 파이썬 파일들이 있는 폴더USER_FILE_DIR = BASE_DIR / "user_files"# sys.path에 해당 폴더 추가sy..
정리/Python
2026. 5. 3. 22:53
