I wish i could write like
>>> print many_lines_message | tail -1
in python console, how to do that?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If you really want to pass the output of an arbitrary Python expression to an external command, you will need to start a process and use a pipe. In bash a pipe is spelt
|, in Python the subprocess module can help you with that. But if you just need the example you gave, the answers by eumiro and Jon Clements are what you need.