<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DZone Snippets: getch code</title>
    <link>http://snippets.dzone.com/posts</link>
    <pubDate>Fri, 25 Jul 2008 05:27:10 GMT</pubDate>
    <description>DZone Snippets: getch code</description>
    <item>
      <title>Cross platform getch() in python</title>
      <link>http://snippets.dzone.com/posts/show/915</link>
      <description>For Unix, it uses sys, tty, termios modules.&lt;br /&gt;&lt;code&gt;&lt;br /&gt;import sys, tty, termios&lt;br /&gt;fd = sys.stdin.fileno()&lt;br /&gt;old_settings = termios.tcgetattr(fd)&lt;br /&gt;tty.setraw(sys.stdin.fileno())&lt;br /&gt;ch = sys.stdin.read(1)&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;For Windows, it uses msvcrt module.&lt;br /&gt;&lt;code&gt;&lt;br /&gt;import msvcrt&lt;br /&gt;ch = msvcrt.getch()&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;See more details and OSX code in this &lt;a href=http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/134892&gt;recipe&lt;/a&gt; by Danny Yoo.</description>
      <pubDate>Sat, 26 Nov 2005 14:51:17 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/915</guid>
      <author>korakot (Korakot Chaovavanich)</author>
    </item>
  </channel>
</rss>
