“Unexpected EOF while parsing” after a “try” statement

前端 未结 3 1004
我寻月下人不归
我寻月下人不归 2021-01-27 20:38

I\'m really, really new to Python and was making a small test program.

Here is my code:

def start ():   
    print (\"This is where text would b         


        
3条回答
  •  孤独总比滥情好
    2021-01-27 21:07

    For the EOF error, you can just get rid of that try: like so

    def start ():   
        print ("This is where text would be")   
        prompt_sta ()
    
    def prompt_sta ():  
        prompt_0=raw_input("Input a Command: ")  
    
        if prompt_0 == 'Okay':                             
            next_screen ()  
        else:   
            print ('Type Okay.')   
            prompt_sta() 
    

    You can also just add an except clause, as Fernando said, if you still want to use try:

提交回复
热议问题