How do I read a text file into a string variable in Python
<p>I use the following code segment to read a file in python</p>

<pre><code>with open ("data.txt", "r") as myfile:
    data=myfile.readlines()
</code></pre>

<p>input file is</p>

<pre><code>LLKKKKKKKKMMMMMMMMNNNNNNNNNNNNN
GGGGGGGGGHHHHHHHHHHHHHHHHHHHHEEEEEEEE
</code></pre>

<p>and when i print data i get</p>

<pre><code>['LLKKKKKKKKMMMMMMMMNNNNNNNNNNNNN\n', 'GGGGGGGGGHHHHHHHHHHHHHHHHHHHHEEEEEEEE']
</code></pre>

<p>As i see data is in list form. How do i make it string. And also how do i remove \n, [, and ] characters from it ?</p>
