python - How to quit from input() function after call codecs.getreader for stdin? -


i try read windows console utf-8 letters.

i have 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 strange thing:

after pressing enter button execution of stdin.readline() or raw_input() or input() functions not stop.

what do wrong? or how send eof() stop input console in case?

on mac, hitting ^d (ctrl-d) twice trick. not sure if work across systems, give shot.


Comments

Popular posts from this blog

matlab - error with cyclic autocorrelation function -

django - (fields.E300) Field defines a relation with model 'AbstractEmailUser' which is either not installed, or is abstract -

c# - What is a good .Net RefEdit control to use with ExcelDna? -