Issue
I have some programming assignments which read input data from stdin like this:
text = sys.stdin.readline().strip()
I am using Spyder as my development environment, and am not able to find a way to give the stdin. So, I added a -infile option to the code, and am reading from the file.
However, when submitting, I need to revert back to reading the stdin. How can I read stdin in the first place? I know how to do this from linux command line, but for now have to use windows.
Solution
(Spyder maintainer here) The code you posted only works to read text when you run it in a system terminal (i.e. bash or cmd.exe).
It doesn't work in Spyder because its terminals are implemented in a different technology (PyQt vs. readline).
Answered By - Carlos Cordoba
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.