파이썬 종료하기 quit()

Jmnote bot (토론 | 기여)님의 2020년 11월 2일 (월) 02:32 판 (봇: 자동으로 텍스트 교체 (-source +syntaxhighlight))
(차이) ← 이전 판 | 최신판 (차이) | 다음 판 → (차이)

1 개요[ | ]

Python quit(), exit()
파이썬 quit(), exit()
quit()
import sys
sys.exit(0)
import os
os._exit(1)

2 예시[ | ]

root@localhost:~# cat hello.py 
print('hello')
quit()
print('world')
root@localhost:~# python3 hello.py 
hello
root@localhost:~# echo $?
0
root@localhost:~# cat hello255.py 
print('hello')
quit(255)
print('world')
root@localhost:~# python3 hello.py 
hello
root@localhost:~# echo $?
255

3 같이 보기[ | ]

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}