This question is most likely on here somewhere, and anyone who can redirect me, that would be great.
But I can't find it - most likely not sure which appropriate key terms to use as everything gives me the python command line interpreter.
But I simply want to be able to use the output from a python as the input to another program from the command line. For example:
./program `python print 'A' * 100`
However, I get an error of:
python: can't open file 'print': [Errno 2] No such file or directory
What is the proper way to do this?
-
Interesting collection of other redirection options in python, worth a read, hereShawn Mehan– Shawn Mehan2015年10月28日 22:49:04 +00:00Commented Oct 28, 2015 at 22:49
2 Answers 2
the python executable with no switches expects no arguments(for an interactive shell) or a *.py file to run
you can use the -c switch to pass in code
./program `python -c "print 'A' * 100"`