Hi I have a very naive question.
I have this piece of python code test.py that I am trying to test run.
May I know how do I run it using my own inputs?
I tried running it on my command line using
python3 test.py ABCD but the command line does not return anything..
I have also tried python3 test.py ABCD.txt where ABCD.txtcontains the line ABCD but also to no avail...
Any help would be greatly appreciated, thank you.
import sys
output = []
for ln in sys.stdin:
for c in ln:
if c in 'ABCD':
output.append(c)
sys.stdout.write(''.join(output) + '\n')
python3 test.py < ABCD.txtpython3 test.py <<<'ABCD', if you only want one line of input. Orecho ABCD | python3 test.py, or... etc, etc etc.