0

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?

1
  • Interesting collection of other redirection options in python, worth a read, here Commented Oct 28, 2015 at 22:49

2 Answers 2

1

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"`
Sign up to request clarification or add additional context in comments.

Comments

0
python -c "print 'A' * 10" | ./program

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.