After using stdin.read()/stdin.readlines()/stdin.readlines(), every following input will not work(it will show off EOF error,) beacuse input() is set to prevent the EOF reading. However, isn't there any way to clean the sys.stdin() buffer? code sample
Asked
Active
Viewed 44 times
-4
-
That doesn't make sense. Why are you trying to interact with stdin in this way? – user2357112 Jul 17 '21 at 11:50
-
If a program reads `stdin` until it reaches EOF, that is a pattern where the program runs to completion from a command line and its input has been redirected to `stdin` using `<`. In that case there is no need to continue to read from `stdin` afterwards. If, on the other hand, you want your program to interact with the user, then don't take initialization data from `stdin` and instead read it from a file named on the command line. And use `input()` to get data from `stdin` in preference to using file operations like `read()`. Not because they won't work but because that is not a Python idiom. – BoarGules Jul 17 '21 at 12:18
1 Answers
-1
Here is the link to the Delete Post
input() after readlines() from sys.stdin?
the answer is no, but there may be a way to re-construct your input by using wsvcrt module
Just In Case For The Deleted Page Will Never Be Seen

Anthony
- 9
- 2