
파이썬(Python) - VScode에서 제공하는 task runner 설정
junheekim
·2022. 12. 21. 12:18
VScode에서 제공하는 task runner 설정
VScode에서 task.json파일을 만들어 단축키(ctrl+chift+B)로 해당 명령을 실행할 수 있도록 Run Task기능을 사용해 보겠습니다.
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "Project Label",
"type": "shell",
"command": "python",
"args": [
"${file}"
],
"presentation": {
"reveal": "always",
"panel": "new"
},
"options": {
"env": {
"PYTHONIOENCODING": "UTF-8"
}
},
"group": {
"kind": "build",
"isDefault": true
}
}
]
}
어떻게 해서 실행되는것인지 task.json파일을 살펴보자면 아래와같은 코드가 있을텐데 여기서 command란 실행하는 명령어이고 args는 인자값입니다.
그래서 Ctrl + Shift + B 키를 이용하여 실행을 하면 python ${file}로 실행이 되는데 여기서 ${file}에는 현재 실행된 파일의 위치가 들어갑니다.
이와 같이 실행되는 것을 볼 수 있습니다.
참고자료
https://detail-from-a-to-z.tistory.com/31
https://myjamong.tistory.com/40
'Language > Python' 카테고리의 다른 글
파이썬(Python) - Selenium iframe 제어하기 (0) | 2023.03.27 |
---|---|
파이썬(Python) - VSCode 가상환경에서 디버깅시 BreakPoint 무시 에러 (0) | 2023.03.16 |
파이썬(Python) - 모듈 가져오기(import , from , as ) (0) | 2022.12.27 |
파이썬(Python 기본문법)-01 기본출력(Separator옵션,end옵션,format함수) 및 Escape Code (0) | 2022.12.14 |