0
가능한 중복 :
tell whether python is in -i mode
Tell if python is in interactive mode파이썬 스크립트가 대화식 옵션 '-i'로 실행되는지 여부를 알 수 있습니까?
는 파이썬 스크립트는 대화 형 옵션 -i 실행되었는지 여부를 확인하는 방법이 있나요?
if interactive_mode:
print 'I am in interactive mode!'
else:
print 'I am in batch mode!'
그런 다음
python hello_world.py
I am in batch mode!
python -i hello_world.py
>> I am in interactive mode!