Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

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.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8644515
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T12:18:46+00:00 2026-06-12T12:18:46+00:00

Given the following python script…. $ cat readStdin.py #!/usr/bin/python import sys var = .join(sys.stdin.readlines()).rstrip()

  • 0

Given the following python script….

$ cat readStdin.py 
#!/usr/bin/python

import sys

var = "".join(sys.stdin.readlines()).rstrip()
print var

… I get the follwing output:

$ echo hello  | python -i readStdin.py 
hello
>>> 
$

… in other words it does not hang in the python console, but goes back to bash. Does anyone out there know how to make it stay in the python console???

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T12:18:47+00:00Added an answer on June 12, 2026 at 12:18 pm

    Consider this –

    $ echo print  4*2 | python -i
    Python 2.7.2 (default, Jun 20 2012, 16:23:33) 
    Type "help", "copyright", "credits" or "license" for more information.
    >>> 8
    >>> 
    $
    

    Echo produces print 4*2. Python even in interactive mode, considers this as input to be interpreted. Hence we see the 8 there. After this, the interpreter encounters an EOF, so it quits. Consider what you press to quit the interpreter – Ctrl+d or ^D. This is just another way to produce EOF on *nix.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am new to Python and I have written this simple script: #!/usr/bin/python3 import
I received this python script that generates a file checksum: import sys,os if __name__==__main__:
The following python script allows me to scrape email addresses from a given file
the following python script allows me to scrape email addresses from a given file
I have the following python script and it works beautifully. import urllib2 url =
Given following array: var arr = [undefined, undefined, 2, 5, undefined, undefined]; I'd like
Given the following code: $(.force-selection).blur(function() { var value = $('matched-item').val(); //check if the input's
Consider the following Python script, which uses SQLAlchemy and the Python multiprocessing module. This
I am trying to run the following HelloWorld Script at Command Line import tornado.httpserver
My Python script accepts a number of options such as the following: python ./Controller.py

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.