아미(아름다운미소)

[python] os.startfile Windows 특정 프로그램을 실행하는 방법 본문

랭귀지/PYTHON

[python] os.startfile Windows 특정 프로그램을 실행하는 방법

유키공 2018. 11. 4. 11:00

[python] os.startfile Windows 특정 프로그램을 실행하는 방법

Windows를 사용하는 경우 Explorer에서 파일을 두 번 클릭하거나 DOS "start"명령에 대한 인수로 파일 이름을 지정하는 것과 같은 역할을합니다.확장명과 관련된 응용 프로그램이있는 경우 해당 파일이 열립니다 .

filepath = 'test.txt'
import os
os.startfile(filepath)
예:
import os
os.startfile('test.txt')
메모장이 .txt 파일과 연결된 경우 textfile.txt가 메모장과 함께 열립니다.


Comments