python library for user input

前端 未结 5 1691
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-01-05 17:37

I am implementing a small command line tool in python that needs to ask the user a couple of questions. I use

raw_input(\'Are you male or female?\')
<         


        
5条回答
  •  萌比男神i
    2021-01-05 18:16

    From the accepted answer to this question: the cmd library might be of interest to you.

    "The Cmd class provides a simple framework for writing line-oriented command interpreters."

    This Python Module of the Week page features it, and it has some examples and explanations.

提交回复
热议问题