Timeline for How to read stdin in a script?
Current License: CC BY-SA 4.0
13 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Apr 26, 2019 at 23:23 | comment | added | Yannik | Oh I see -- yes it helps now. I didn't know terminal input was considered standard input. Sorry I'm just very new to this stuff. | |
| Apr 26, 2019 at 17:25 | comment | added | Kit. |
It is written there (Note that sys.stdin.read() will read from standard input till EOF. (which is usually Ctrl+D.) ). If it doesn't help you, i am sorry.
|
|
| Apr 25, 2019 at 13:32 | comment | added | Yannik | Thanks but this doesn't help. I need an example of how I use terminal with sys.stdin.read(). | |
| Apr 25, 2019 at 0:20 | comment | added | Kit. | See here | |
| Apr 24, 2019 at 23:16 | comment | added | Yannik | I also ran python optimal_summands.py, pressed enter, and then typed in 15 (that should have been processed as stdin). Nothing happened still. | |
| Apr 24, 2019 at 23:10 | comment | added | Yannik | So what’s the point of stdin if I can’t use terminal input? How would I provide data to stdin? | |
| Apr 24, 2019 at 21:31 | comment | added | OneCricketeer | Related - stackoverflow.com/questions/17658512/… | |
| Apr 24, 2019 at 21:25 | history | edited | martineau | CC BY-SA 4.0 |
Edited title to better express question being asked and removed language tag.
|
| Apr 24, 2019 at 21:22 | comment | added | juanpa.arrivillaga |
You haven't provided anything to the standard input of the process, so sys.stdin.read() is going to hang, waiting for an EOF from stdin
|
|
| Apr 24, 2019 at 21:21 | comment | added | Kit. |
15 in your case is not in stdin, but in argv. That "nothing happens" is probably a program waiting for your input.
|
|
| Apr 24, 2019 at 21:20 | comment | added | chepner |
15 is a command line argument, not something on standard input.
|
|
| Apr 24, 2019 at 21:20 | answer | added | Julian Camilleri | timeline score: 3 | |
| Apr 24, 2019 at 21:17 | history | asked | Yannik | CC BY-SA 4.0 |