Share
Sign In
Code / Tip 공유 게시판
[python] 프로그램 실행
김영호_메가존
import subprocess def run_software(command): try: # 실행하고자 하는 명령을 subprocess.run()에 전달 result = subprocess.run(command, check=True, capture_output=True, text=True) return result.stdout except subprocess.CalledProcessError as e: print(f"Error occurred while running the command. {e}") return None if __name__ == "__main__": # 예: Windows에서 notepad.exe를 실행하려면 run_software(["notepad.exe"]) # 다른 운영체제나 다른 소프트웨어를 실행하려면 위의 ["notepad.exe"] 부분을 변경하면 됩니다.
👍