input vs. raw_input: Python Interactive Shell Application?

前端 未结 2 1635

I was working off of the answer in this question: Python Interactive Shell Type Application

My code looks like this

def main():
  while True:
    s =         


        
2条回答
  •  情歌与酒
    2021-01-19 12:00

    if s == 'hello':
      print('hi')
    
    elif s == 'exit':
      break
    
    else:
      print('Undefined input')
    

    This should take care of undefined user input.

提交回复
热议问题