Why do I have to press Ctrl+D twice to close stdin?

后端 未结 5 838
死守一世寂寞
死守一世寂寞 2021-01-04 05:12

I have the following Python script that reads numbers and outputs an error if the input is not a number.

import fileinput
import sys
for line in (txt.strip()         


        
5条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-01-04 05:46

    Most likely this has to do with Python the following Python issues:

    • 5505: sys.stdin.read() doesn't return after first EOF on Windows, and
    • 1633941: for line in sys.stdin: doesn't notice EOF the first time.

提交回复
热议问题