<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Tahoma
}
--></style></head>
<body class='hmmessage'><div dir='ltr'>
I want to run code until a "enter" is pressed. Well, it shouldn't wait for the user to enter "enter"<div><br></div><div>This is my code:</div><div><br></div><div><span style="font-family: Arial, sans-serif; font-size: 14px; line-height: 20px; background-color: rgb(255, 255, 255); ">import msvcrt</span><br style="font-family: Arial, sans-serif; font-size: 14px; line-height: 20px; background-color: rgb(255, 255, 255); "><br style="font-family: Arial, sans-serif; font-size: 14px; line-height: 20px; background-color: rgb(255, 255, 255); "><span style="font-family: Arial, sans-serif; font-size: 14px; line-height: 20px; background-color: rgb(255, 255, 255); ">chr = 0</span><br style="font-family: Arial, sans-serif; font-size: 14px; line-height: 20px; background-color: rgb(255, 255, 255); "><span style="font-family: Arial, sans-serif; font-size: 14px; line-height: 20px; background-color: rgb(255, 255, 255); ">while chr != 'q':</span></div><div> print "my code",<br style="font-family: Arial, sans-serif; font-size: 14px; line-height: 20px; background-color: rgb(255, 255, 255); "><span style="font-family: Arial, sans-serif; font-size: 14px; line-height: 20px; background-color: rgb(255, 255, 255); "> if msvcrt.kbhit():</span><br style="font-family: Arial, sans-serif; font-size: 14px; line-height: 20px; background-color: rgb(255, 255, 255); "><span style="font-family: Arial, sans-serif; font-size: 14px; line-height: 20px; background-color: rgb(255, 255, 255); "> chr = msvcrt.getch()</span><br style="font-family: Arial, sans-serif; font-size: 14px; line-height: 20px; background-color: rgb(255, 255, 255); "></div><div><span style="font-family: Arial, sans-serif; font-size: 14px; line-height: 20px; background-color: rgb(255, 255, 255); "><br></span></div><div><span style="font-family: Arial, sans-serif; font-size: 14px; line-height: 20px; background-color: rgb(255, 255, 255); ">This isn't working the way I wanted. When ever I press enter, the loop is starting in a new line and continuing.</span></div><div><span style="font-family: Arial, sans-serif; font-size: 14px; line-height: 20px; background-color: rgb(255, 255, 255); "><br></span></div><div><span style="font-family: Arial, sans-serif; font-size: 14px; line-height: 20px; background-color: rgb(255, 255, 255); ">I even added "break" statement in "if" block but it isn't working</span></div><div><span style="font-family: Arial, sans-serif; font-size: 14px; line-height: 20px; background-color: rgb(255, 255, 255); ">Can you tell me how to do that?</span></div><div><span style="font-family: Arial, sans-serif; font-size: 14px; line-height: 20px; background-color: rgb(255, 255, 255); "><br></span></div><div><span style="font-family: Arial, sans-serif; font-size: 14px; line-height: 20px; background-color: rgb(255, 255, 255); ">I am on windows. So, as msvcrt is for windows, I wonder if there is any module that works for both,</span></div>                                            </div></body>
</html>