Popular recipes tagged "ask"http://code.activestate.com/recipes/tags/ask/2010-03-09T18:37:52-08:00ActiveState Code Recipesquery yes/no (Python) 2010-03-09T17:57:28-08:00Trent Mickhttp://code.activestate.com/recipes/users/4173505/http://code.activestate.com/recipes/577058-query-yesno/ <p style="color: grey"> Python recipe 577058 by <a href="/recipes/users/4173505/">Trent Mick</a> (<a href="/recipes/tags/ask/">ask</a>, <a href="/recipes/tags/cli/">cli</a>, <a href="/recipes/tags/no/">no</a>, <a href="/recipes/tags/query/">query</a>, <a href="/recipes/tags/raw_input/">raw_input</a>, <a href="/recipes/tags/yes/">yes</a>). Revision 2. </p> <p>Ask the user a question using raw_input() and looking something like this:</p> <pre class="prettyprint"><code>QUESTION [Y/n] ...validate... </code></pre> <p>See also: <a href="http://code.activestate.com/recipes/577096/">Recipe 577096</a> (query custom answers), <a href="http://code.activestate.com/recipes/577097/">Recipe 577097</a> (query yes/no/quit), <a href="http://code.activestate.com/recipes/577098/">Recipe 577098</a> (query long), <a href="http://code.activestate.com/recipes/577099/">Recipe 577099</a> (query)</p> query yes/no/quit (Python) 2010-03-09T17:57:18-08:00Trent Mickhttp://code.activestate.com/recipes/users/4173505/http://code.activestate.com/recipes/577097-query-yesnoquit/ <p style="color: grey"> Python recipe 577097 by <a href="/recipes/users/4173505/">Trent Mick</a> (<a href="/recipes/tags/ask/">ask</a>, <a href="/recipes/tags/cli/">cli</a>, <a href="/recipes/tags/no/">no</a>, <a href="/recipes/tags/query/">query</a>, <a href="/recipes/tags/quit/">quit</a>, <a href="/recipes/tags/raw_input/">raw_input</a>, <a href="/recipes/tags/yes/">yes</a>). </p> <p>Ask the user a question using raw_input() and looking something like this:</p> <pre class="prettyprint"><code>QUESTION [Y/n/q] ...validate... </code></pre> <p>See also: <a href="http://code.activestate.com/recipes/577058/">Recipe 577058</a> (query yes/no), <a href="http://code.activestate.com/recipes/577096/">Recipe 577096</a> (query custom answers), <a href="http://code.activestate.com/recipes/577098/">Recipe 577098</a> (query long), <a href="http://code.activestate.com/recipes/577099/">Recipe 577099</a> (query)</p> command line query (Python) 2010-03-09T18:37:52-08:00Trent Mickhttp://code.activestate.com/recipes/users/4173505/http://code.activestate.com/recipes/577098-command-line-query/ <p style="color: grey"> Python recipe 577098 by <a href="/recipes/users/4173505/">Trent Mick</a> (<a href="/recipes/tags/ask/">ask</a>, <a href="/recipes/tags/cli/">cli</a>, <a href="/recipes/tags/query/">query</a>, <a href="/recipes/tags/raw_input/">raw_input</a>). Revision 3. </p> <p>Ask the user a question using raw_input() and looking something like this (<code>style=="compact"</code>):</p> <pre class="prettyprint"><code>QUESTION [DEFAULT]: _ ...validation... </code></pre> <p>or this (<code>style=="verbose"</code>):</p> <pre class="prettyprint"><code>QUESTION Hit &lt;Enter&gt; to use the default, DEFAULT. &gt; _ ...validate... </code></pre> <p>It supports some basic validation/normalization of the given answer.</p> <p>See also: <a href="http://code.activestate.com/recipes/577058/">Recipe 577058</a> (query yes/no), <a href="http://code.activestate.com/recipes/577097/">Recipe 577097</a> (query yes/no/quit), <a href="http://code.activestate.com/recipes/577096/">Recipe 577096</a> (query custom answers)</p> query (Python) 2010-03-09T18:34:05-08:00Trent Mickhttp://code.activestate.com/recipes/users/4173505/http://code.activestate.com/recipes/577099-query/ <p style="color: grey"> Python recipe 577099 by <a href="/recipes/users/4173505/">Trent Mick</a> (<a href="/recipes/tags/ask/">ask</a>, <a href="/recipes/tags/cli/">cli</a>, <a href="/recipes/tags/query/">query</a>, <a href="/recipes/tags/raw_input/">raw_input</a>). </p> <p>Ask/prompt the user for a short piece of data. <a href="http://code.activestate.com/recipes/577098/">Recipe 577098</a> is a much more generic/functional (but longer) take on this.</p>