I try to read from windows console utf-8 letters.
I have the code follows:
import codecs
sys.stdin = codecs.getreader('utf-8')(sys.stdin)
if __name__ == '__main__':
print 'query=',
query = sys.stdin.readline()
print query
But there is a strange thing:
After pressing the enter button the execution of the stdin.readline()
or raw_input()
or input()
functions will not stop.
What do I do wrong? Or how to send eof()
to stop input from console in this case?
答案 0 :(得分:1)