title: Python how to send multiple strings as input to script when prompted
body: <p>My script takes username and password from the prompt when executed. I am able to send a single string as input but unable to send multiple strings based on condition. Can someone help me how to achieve this or if any alternate approach is also fine? I have tried following ways.</p>
  
  <pre><code>import sys
  import StringIO
  import getpass
  class ProxyDetails:
      def __init__(self,option):
          self.option = option
          self.proxy_option = self.get_web_proxy_details()
          self.call_request()
          self.parse_test()
  
      def get_web_proxy_details(self):
          if self.option == "Default":
              self.proxy_username = getpass.getpass("Enter Username for Proxy : ")
              self.proxy_password = getpass.getpass("Enter Password for Proxy : ")
              print "self.proxy_username is {} ".format(self.proxy_username)
              print "self.proxy_password is {} ".format(self.proxy_password)
          else:
              print("proxy is none ")
  
      def call_request(self):
          # this method will do API call
          pass
      def parse_test(self):
          #this method will parse the json
          pass
  
  f1 = sys.stdin
  f = StringIO.StringIO('admin')
  f = StringIO.StringIO('admin123')
  sys.stdin = f
  obj=ProxyDetails(option="Default")
  sys.stdin = f1
  </code></pre>
  
  <p>Another way</p>
  
  <pre><code>f = StringIO.StringIO('admin','\n','admin123')
  sys.stdin=f
  </code></pre>
  
  <p>Another way</p>
  
  <pre><code>f = StringIO.StringIO('admin','admin123')
  sys.stdin=f
  </code></pre>