0

I have a question in python script that I've build in while

how can I close the full window of (cmd.exe) depending on IF/ELSE statement

like

#python script:    
  if x = 1 : 
    #script_continue..
  else: 
    print('ops')
    exit() #close the total cmd.exe window automatically not just the python script

I try different methods but not work as I want

Thanks.

Romer
  • 30
  • 9

1 Answers1

0

First: if x = 1 is an assignment, not a comparison.

if x == 1 # this is the right way

Second, check this out: Python to close own CMD shell window on exit

jmcsagdc
  • 31
  • 1
  • 5