Popular recipes tagged "raw_input" but not "quit"http://code.activestate.com/recipes/tags/raw_input-quit/2011-10-13T19:04:45-07:00ActiveState Code RecipesRemove the real "input()" function from a current text mode Python 1.4.0 to 2.7.2 session... (Python) 2011-10-13T19:04:45-07:00Barry Walkerhttp://code.activestate.com/recipes/users/4177147/http://code.activestate.com/recipes/577906-remove-the-real-input-function-from-a-current-text/ <p style="color: grey"> Python recipe 577906 by <a href="/recipes/users/4177147/">Barry Walker</a> (<a href="/recipes/tags/amiga/">amiga</a>, <a href="/recipes/tags/apple/">apple</a>, <a href="/recipes/tags/e_uae/">e_uae</a>, <a href="/recipes/tags/input/">input</a>, <a href="/recipes/tags/linux/">linux</a>, <a href="/recipes/tags/macbook_pro/">macbook_pro</a>, <a href="/recipes/tags/raw_input/">raw_input</a>, <a href="/recipes/tags/windows/">windows</a>, <a href="/recipes/tags/winuae/">winuae</a>). </p> <p>The single very powerful line of just the fifteen ASCII characters says it all...</p> <p>Read the code for more information...</p> <p>Tested on the platforms and versions inside the code...</p> <p>This is entirely Public Domain and hopefully it will be of use to many a Python coder...</p> <p>Enjoy finding simple solutions to often very difficult problems...</p> <p>Bazza, G0LCU...</p> "raw_input" For All Versions Of Python... (Python) 2011-08-10T16:52:04-07:00Barry Walkerhttp://code.activestate.com/recipes/users/4177147/http://code.activestate.com/recipes/577836-raw_input-for-all-versions-of-python/ <p style="color: grey"> Python recipe 577836 by <a href="/recipes/users/4177147/">Barry Walker</a> (<a href="/recipes/tags/amiga/">amiga</a>, <a href="/recipes/tags/e_uae/">e_uae</a>, <a href="/recipes/tags/input/">input</a>, <a href="/recipes/tags/linux/">linux</a>, <a href="/recipes/tags/raw_input/">raw_input</a>, <a href="/recipes/tags/windows/">windows</a>, <a href="/recipes/tags/winuae/">winuae</a>). </p> <p>The code says it all... ;o)</p> <p>Put the two lines in any Python code and have universal KB input...</p> <p>Enjoy finding simple solutions to often very difficult problems...</p> <p>Bazza, G0LCU...</p> query 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> 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>