728x90
이 셋팅이 가장 좋은것 같다.
소개
a.py 에 코드를 적는다.
input.txt에 입력 값을 넣는다.
F5를 누른다.
output.txt에 결과가 표시된다.
셋팅 방법
1. 디버그 패널로 가서
그럼 패널에
이런게 뜨는데 launch.json 파일을 만들라는 말을 클릭한다.
그럼 a.py이 위치한 곳에 폴더가 생성되고 그안에 json파일 이생긴다.
거기에
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Python: Current File",
"type": "python",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal",
"justMyCode": true,
"args": ["<", "input.txt", ">", "output.txt"] // 이부분을 추가
}
]
}
이렇게 "args": ["<", "input.txt", ">", "output.txt"] 이걸 추가하고
실제로도 프로젝트 디렉터리에 input.txt와 output.txt를 만들어주고 a.py와 같이 한 화면에 띄어준다.
vscode의 셋팅 창에서 (Ctrl + , 로 진입)
이런 메뉴를 찾아서 옵션 값을 Command Prompt로 바꿔준다.
이러면 소개에서 한대로 F5를 누르면 다 실행된다. 참고로 F5는
이 버튼의 단축키다. 단축키는 버튼에 마우스를 올려보면 나온다.
728x90