| 1 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> |
| 2 | <html> |
| 3 | <head> |
| 4 | <link rel="STYLESHEET" href="ref.css" type='text/css' /> |
| 5 | <link rel="SHORTCUT ICON" href="../icons/pyfav.png" type="image/png" /> |
| 6 | <link rel='start' href='../index.html' title='Python Documentation Index' /> |
| 7 | <link rel="first" href="ref.html" title='Python Reference Manual' /> |
| 8 | <link rel='contents' href='contents.html' title="Contents" /> |
| 9 | <link rel='index' href='genindex.html' title='Index' /> |
| 10 | <link rel='last' href='about.html' title='About this document...' /> |
| 11 | <link rel='help' href='about.html' title='About this document...' /> |
| 12 | <link rel="prev" href="interactive.html" /> |
| 13 | <link rel="parent" href="top-level.html" /> |
| 14 | <link rel="next" href="node105.html" /> |
| 15 | <meta name='aesop' content='information' /> |
| 16 | <title>8.4 Expression input</title> |
| 17 | </head> |
| 18 | <body> |
| 19 | <DIV CLASS="navigation"> |
| 20 | <div id='top-navigation-panel' xml:id='top-navigation-panel'> |
| 21 | <table align="center" width="100%" cellpadding="0" cellspacing="2"> |
| 22 | <tr> |
| 23 | <td class='online-navigation'><a rel="prev" title="8.3 Interactive input" |
| 24 | href="interactive.html"><img src='../icons/previous.png' |
| 25 | border='0' height='32' alt='Previous Page' width='32' /></A></td> |
| 26 | <td class='online-navigation'><a rel="parent" title="8. Top-level components" |
| 27 | href="top-level.html"><img src='../icons/up.png' |
| 28 | border='0' height='32' alt='Up One Level' width='32' /></A></td> |
| 29 | <td class='online-navigation'><a rel="next" title="A. History and License" |
| 30 | href="node105.html"><img src='../icons/next.png' |
| 31 | border='0' height='32' alt='Next Page' width='32' /></A></td> |
| 32 | <td align="center" width="100%">Python Reference Manual</td> |
| 33 | <td class='online-navigation'><a rel="contents" title="Table of Contents" |
| 34 | href="contents.html"><img src='../icons/contents.png' |
| 35 | border='0' height='32' alt='Contents' width='32' /></A></td> |
| 36 | <td class='online-navigation'><img src='../icons/blank.png' |
| 37 | border='0' height='32' alt='' width='32' /></td> |
| 38 | <td class='online-navigation'><a rel="index" title="Index" |
| 39 | href="genindex.html"><img src='../icons/index.png' |
| 40 | border='0' height='32' alt='Index' width='32' /></A></td> |
| 41 | </tr></table> |
| 42 | <div class='online-navigation'> |
| 43 | <b class="navlabel">Previous:</b> |
| 44 | <a class="sectref" rel="prev" href="interactive.html">8.3 Interactive input</A> |
| 45 | <b class="navlabel">Up:</b> |
| 46 | <a class="sectref" rel="parent" href="top-level.html">8. Top-level components</A> |
| 47 | <b class="navlabel">Next:</b> |
| 48 | <a class="sectref" rel="next" href="node105.html">A. History and License</A> |
| 49 | </div> |
| 50 | <hr /></div> |
| 51 | </DIV> |
| 52 | <!--End of Navigation Panel--> |
| 53 | |
| 54 | <H1><A NAME="SECTION0010400000000000000000"></A><A NAME="expression-input"></A> |
| 55 | <a id='l2h-626' xml:id='l2h-626'></a> |
| 56 | <BR> |
| 57 | 8.4 Expression input |
| 58 | </H1> |
| 59 | |
| 60 | <P> |
| 61 | There are two forms of expression input. Both ignore leading |
| 62 | whitespace. |
| 63 | The string argument to <tt class="function">eval()</tt> must have the following form: |
| 64 | <a id='l2h-627' xml:id='l2h-627'></a> |
| 65 | <P> |
| 66 | <dl><dd class="grammar"> |
| 67 | <div class="productions"> |
| 68 | <table> |
| 69 | <tr> |
| 70 | <td><a id='tok-eval_input' xml:id='tok-eval_input'>eval_input</a></td> |
| 71 | <td>::=</td> |
| 72 | <td><a class='grammartoken' href="exprlists.html#tok-expression_list">expression_list</a> NEWLINE*</td></tr> |
| 73 | </table> |
| 74 | </div> |
| 75 | <a class="grammar-footer" |
| 76 | href="grammar.txt" type="text/plain" |
| 77 | >Download entire grammar as text.</a> |
| 78 | </dd></dl> |
| 79 | |
| 80 | <P> |
| 81 | The input line read by <tt class="function">input()</tt> must have the following form: |
| 82 | <a id='l2h-628' xml:id='l2h-628'></a> |
| 83 | <P> |
| 84 | <dl><dd class="grammar"> |
| 85 | <div class="productions"> |
| 86 | <table> |
| 87 | <tr> |
| 88 | <td><a id='tok-input_input' xml:id='tok-input_input'>input_input</a></td> |
| 89 | <td>::=</td> |
| 90 | <td><a class='grammartoken' href="exprlists.html#tok-expression_list">expression_list</a> NEWLINE</td></tr> |
| 91 | </table> |
| 92 | </div> |
| 93 | <a class="grammar-footer" |
| 94 | href="grammar.txt" type="text/plain" |
| 95 | >Download entire grammar as text.</a> |
| 96 | </dd></dl> |
| 97 | |
| 98 | <P> |
| 99 | Note: to read `raw' input line without interpretation, you can use the |
| 100 | built-in function <tt class="function">raw_input()</tt> or the <tt class="method">readline()</tt> method |
| 101 | of file objects. |
| 102 | <a id='l2h-629' xml:id='l2h-629'></a><a id='l2h-633' xml:id='l2h-633'></a> |
| 103 | <a id='l2h-630' xml:id='l2h-630'></a><a id='l2h-632' xml:id='l2h-632'></a> |
| 104 | <P> |
| 105 | |
| 106 | <P> |
| 107 | |
| 108 | <DIV CLASS="navigation"> |
| 109 | <div class='online-navigation'> |
| 110 | <p></p><hr /> |
| 111 | <table align="center" width="100%" cellpadding="0" cellspacing="2"> |
| 112 | <tr> |
| 113 | <td class='online-navigation'><a rel="prev" title="8.3 Interactive input" |
| 114 | href="interactive.html"><img src='../icons/previous.png' |
| 115 | border='0' height='32' alt='Previous Page' width='32' /></A></td> |
| 116 | <td class='online-navigation'><a rel="parent" title="8. Top-level components" |
| 117 | href="top-level.html"><img src='../icons/up.png' |
| 118 | border='0' height='32' alt='Up One Level' width='32' /></A></td> |
| 119 | <td class='online-navigation'><a rel="next" title="A. History and License" |
| 120 | href="node105.html"><img src='../icons/next.png' |
| 121 | border='0' height='32' alt='Next Page' width='32' /></A></td> |
| 122 | <td align="center" width="100%">Python Reference Manual</td> |
| 123 | <td class='online-navigation'><a rel="contents" title="Table of Contents" |
| 124 | href="contents.html"><img src='../icons/contents.png' |
| 125 | border='0' height='32' alt='Contents' width='32' /></A></td> |
| 126 | <td class='online-navigation'><img src='../icons/blank.png' |
| 127 | border='0' height='32' alt='' width='32' /></td> |
| 128 | <td class='online-navigation'><a rel="index" title="Index" |
| 129 | href="genindex.html"><img src='../icons/index.png' |
| 130 | border='0' height='32' alt='Index' width='32' /></A></td> |
| 131 | </tr></table> |
| 132 | <div class='online-navigation'> |
| 133 | <b class="navlabel">Previous:</b> |
| 134 | <a class="sectref" rel="prev" href="interactive.html">8.3 Interactive input</A> |
| 135 | <b class="navlabel">Up:</b> |
| 136 | <a class="sectref" rel="parent" href="top-level.html">8. Top-level components</A> |
| 137 | <b class="navlabel">Next:</b> |
| 138 | <a class="sectref" rel="next" href="node105.html">A. History and License</A> |
| 139 | </div> |
| 140 | </div> |
| 141 | <hr /> |
| 142 | <span class="release-info">Release 2.4.2, documentation updated on 28 September 2005.</span> |
| 143 | </DIV> |
| 144 | <!--End of Navigation Panel--> |
| 145 | <ADDRESS> |
| 146 | See <i><a href="about.html">About this document...</a></i> for information on suggesting changes. |
| 147 | </ADDRESS> |
| 148 | </BODY> |
| 149 | </HTML> |