title: How to read a text file into a string variable and strip newlines?
body: <p>I have a text file that looks like:</p>
  <pre><code>ABC
  DEF
  </code></pre>
  <p>How can I read the file into a single-line string without newlines, in this case creating a string <code>'ABCDEF'</code>?</p>
  <hr />
  <p><sub>For reading the file into a <em>list</em> of lines, but removing the trailing newline character from each line, see <a href="https://stackoverflow.com/questions/12330522/how-to-read-a-file-without-newlines">How to read a file without newlines?</a>.</sub></p>