title: Python how to remove newline from sys.stdin.readline()
body: <p>I'm defining a function that concatenates two strings given by the user, but the string returned by sys.stdin.readline() includes the newline character so my output doesn't look concatenated at all (technically, this output is still concatenated, but with a "\n" between the two strings.) How do I get rid of the newline?</p>
  
  <pre><code>def concatString(string1, string2):
      return (string1 + string2)
  
  str_1 = sys.stdin.readline()
  str_2 = sys.stdin.readline()
  print( "%s" % concatString(str_1, str_2))
  </code></pre>
  
  <p>console:</p>
  
  <pre><code>hello
  world
  hello
  world
  </code></pre>
  
  <p>I tried read(n) that takes in n number of characters, but it still appends the "\n"</p>
  
  <pre><code>str_1 = sys.stdin.read(5) '''accepts "hello" '''
  str_2 = sys.stdin.read(3) '''accepts "\n" and "wo", discards "rld" '''
  </code></pre>
  
  <p>console:</p>
  
  <pre><code>hello
  world
  hello
  wo
  </code></pre>