Closed pvonmoradi closed 4 years ago
What's your objective in using Codi to achieve this? Sure, you could change the configuration for your interpreter, but I'm not sure how it helps any more than doing python mycode.py <<< $'5 10'
as you mentioned.
I thought it would be cool if I could see the value of variables while coding. Consider the following code:
x = 2
y = 4
z = x + y
z
is immediately shown to be 6. But in this code:
x = int(input())
y = 4
z = x + y
z
's value is not immediately visible. I want the interpreter instance running on codi accept "2" in its STDIN.
Ah, understood! Codi operates directly off stdout/stdin, so achieving what you described will not directly be possible. Instead, maybe you could load your desired input from a file? For example:
with open('input.txt') as f:
x = int(f.read().strip())
y = 4
z = x + y
Is there a way to pass some data to STDIN of the interpreter that codi is running?
For example suppose the python code is like
x, y = [int(x) for x in input().split(' ')]
. Theinput()
function fetches the stdin buffer.How can I make it so that "5 10" is automatically passed into the stdin of the python interpretor instance?
I can do it in bash like this way:
python mycode.py <<< $'5 10'
Thanks