Commit | Line | Data |
---|---|---|
920dae64 AT |
1 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> |
2 | <html> | |
3 | <head> | |
4 | <link rel="STYLESHEET" href="lib.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="lib.html" title='Python Library Reference' /> | |
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="next" href="msvcrt-other.html" /> | |
13 | <link rel="prev" href="msvcrt-files.html" /> | |
14 | <link rel="parent" href="module-msvcrt.html" /> | |
15 | <link rel="next" href="msvcrt-other.html" /> | |
16 | <meta name='aesop' content='information' /> | |
17 | <title>22.1.2 Console I/O </title> | |
18 | </head> | |
19 | <body> | |
20 | <DIV CLASS="navigation"> | |
21 | <div id='top-navigation-panel' xml:id='top-navigation-panel'> | |
22 | <table align="center" width="100%" cellpadding="0" cellspacing="2"> | |
23 | <tr> | |
24 | <td class='online-navigation'><a rel="prev" title="22.1.1 File Operations" | |
25 | href="msvcrt-files.html"><img src='../icons/previous.png' | |
26 | border='0' height='32' alt='Previous Page' width='32' /></A></td> | |
27 | <td class='online-navigation'><a rel="parent" title="22.1 msvcrt - Useful" | |
28 | href="module-msvcrt.html"><img src='../icons/up.png' | |
29 | border='0' height='32' alt='Up One Level' width='32' /></A></td> | |
30 | <td class='online-navigation'><a rel="next" title="22.1.3 Other Functions" | |
31 | href="msvcrt-other.html"><img src='../icons/next.png' | |
32 | border='0' height='32' alt='Next Page' width='32' /></A></td> | |
33 | <td align="center" width="100%">Python Library Reference</td> | |
34 | <td class='online-navigation'><a rel="contents" title="Table of Contents" | |
35 | href="contents.html"><img src='../icons/contents.png' | |
36 | border='0' height='32' alt='Contents' width='32' /></A></td> | |
37 | <td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png' | |
38 | border='0' height='32' alt='Module Index' width='32' /></a></td> | |
39 | <td class='online-navigation'><a rel="index" title="Index" | |
40 | href="genindex.html"><img src='../icons/index.png' | |
41 | border='0' height='32' alt='Index' width='32' /></A></td> | |
42 | </tr></table> | |
43 | <div class='online-navigation'> | |
44 | <b class="navlabel">Previous:</b> | |
45 | <a class="sectref" rel="prev" href="msvcrt-files.html">22.1.1 File Operations</A> | |
46 | <b class="navlabel">Up:</b> | |
47 | <a class="sectref" rel="parent" href="module-msvcrt.html">22.1 msvcrt - Useful</A> | |
48 | <b class="navlabel">Next:</b> | |
49 | <a class="sectref" rel="next" href="msvcrt-other.html">22.1.3 Other Functions</A> | |
50 | </div> | |
51 | <hr /></div> | |
52 | </DIV> | |
53 | <!--End of Navigation Panel--> | |
54 | ||
55 | <H2><A NAME="SECTION0024120000000000000000"></A><A NAME="msvcrt-console"></A> | |
56 | <BR> | |
57 | 22.1.2 Console I/O | |
58 | </H2> | |
59 | ||
60 | <P> | |
61 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> | |
62 | <td><nobr><b><tt id='l2h-5249' xml:id='l2h-5249' class="function">kbhit</tt></b>(</nobr></td> | |
63 | <td><var></var>)</td></tr></table></dt> | |
64 | <dd> | |
65 | Return true if a keypress is waiting to be read. | |
66 | </dl> | |
67 | ||
68 | <P> | |
69 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> | |
70 | <td><nobr><b><tt id='l2h-5250' xml:id='l2h-5250' class="function">getch</tt></b>(</nobr></td> | |
71 | <td><var></var>)</td></tr></table></dt> | |
72 | <dd> | |
73 | Read a keypress and return the resulting character. Nothing is | |
74 | echoed to the console. This call will block if a keypress is not | |
75 | already available, but will not wait for <kbd>Enter</kbd> to be pressed. | |
76 | If the pressed key was a special function key, this will return | |
77 | <code>'\000'</code> or <code>'\xe0'</code>; the next call will return the | |
78 | keycode. The <kbd>Control-C</kbd> keypress cannot be read with this | |
79 | function. | |
80 | </dl> | |
81 | ||
82 | <P> | |
83 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> | |
84 | <td><nobr><b><tt id='l2h-5251' xml:id='l2h-5251' class="function">getche</tt></b>(</nobr></td> | |
85 | <td><var></var>)</td></tr></table></dt> | |
86 | <dd> | |
87 | Similar to <tt class="function">getch()</tt>, but the keypress will be echoed if it | |
88 | represents a printable character. | |
89 | </dl> | |
90 | ||
91 | <P> | |
92 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> | |
93 | <td><nobr><b><tt id='l2h-5252' xml:id='l2h-5252' class="function">putch</tt></b>(</nobr></td> | |
94 | <td><var>char</var>)</td></tr></table></dt> | |
95 | <dd> | |
96 | Print the character <var>char</var> to the console without buffering. | |
97 | </dl> | |
98 | ||
99 | <P> | |
100 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> | |
101 | <td><nobr><b><tt id='l2h-5253' xml:id='l2h-5253' class="function">ungetch</tt></b>(</nobr></td> | |
102 | <td><var>char</var>)</td></tr></table></dt> | |
103 | <dd> | |
104 | Cause the character <var>char</var> to be ``pushed back'' into the | |
105 | console buffer; it will be the next character read by | |
106 | <tt class="function">getch()</tt> or <tt class="function">getche()</tt>. | |
107 | </dl> | |
108 | ||
109 | <P> | |
110 | ||
111 | <DIV CLASS="navigation"> | |
112 | <div class='online-navigation'> | |
113 | <p></p><hr /> | |
114 | <table align="center" width="100%" cellpadding="0" cellspacing="2"> | |
115 | <tr> | |
116 | <td class='online-navigation'><a rel="prev" title="22.1.1 File Operations" | |
117 | href="msvcrt-files.html"><img src='../icons/previous.png' | |
118 | border='0' height='32' alt='Previous Page' width='32' /></A></td> | |
119 | <td class='online-navigation'><a rel="parent" title="22.1 msvcrt - Useful" | |
120 | href="module-msvcrt.html"><img src='../icons/up.png' | |
121 | border='0' height='32' alt='Up One Level' width='32' /></A></td> | |
122 | <td class='online-navigation'><a rel="next" title="22.1.3 Other Functions" | |
123 | href="msvcrt-other.html"><img src='../icons/next.png' | |
124 | border='0' height='32' alt='Next Page' width='32' /></A></td> | |
125 | <td align="center" width="100%">Python Library Reference</td> | |
126 | <td class='online-navigation'><a rel="contents" title="Table of Contents" | |
127 | href="contents.html"><img src='../icons/contents.png' | |
128 | border='0' height='32' alt='Contents' width='32' /></A></td> | |
129 | <td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png' | |
130 | border='0' height='32' alt='Module Index' width='32' /></a></td> | |
131 | <td class='online-navigation'><a rel="index" title="Index" | |
132 | href="genindex.html"><img src='../icons/index.png' | |
133 | border='0' height='32' alt='Index' width='32' /></A></td> | |
134 | </tr></table> | |
135 | <div class='online-navigation'> | |
136 | <b class="navlabel">Previous:</b> | |
137 | <a class="sectref" rel="prev" href="msvcrt-files.html">22.1.1 File Operations</A> | |
138 | <b class="navlabel">Up:</b> | |
139 | <a class="sectref" rel="parent" href="module-msvcrt.html">22.1 msvcrt - Useful</A> | |
140 | <b class="navlabel">Next:</b> | |
141 | <a class="sectref" rel="next" href="msvcrt-other.html">22.1.3 Other Functions</A> | |
142 | </div> | |
143 | </div> | |
144 | <hr /> | |
145 | <span class="release-info">Release 2.4.2, documentation updated on 28 September 2005.</span> | |
146 | </DIV> | |
147 | <!--End of Navigation Panel--> | |
148 | <ADDRESS> | |
149 | See <i><a href="about.html">About this document...</a></i> for information on suggesting changes. | |
150 | </ADDRESS> | |
151 | </BODY> | |
152 | </HTML> |