Thursday, November 18, 2010

"if ($answer =~ /Y|y/)" Python też tak może

import re
import sys

print "...[Y/N]?"
answer = sys.stdin.read(1)
if re.search("Y|y",answer):
print "tak"
elif re.search("N|n",answer):
print "nie"

No comments:

Post a Comment