title: Python - open file - readline - list - convert to string
body: <p>The Issue/Question Details</p>
  
  <p>I have a file (blah.txt) where its contents (a list) look like this:</p>
  
  <p>Key1 = ['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z',' ']</p>
  
  <p>Inside of a simple python file (called CAT.py) I execute the following commands:</p>
  
  <pre><code>infile = open('blah.txt', 'r')
  Key1 = infile.readline()
  infile.close()
  Key1 = Key1.rstrip('\n')
  print(Key1)
  </code></pre>
  
  <blockquote>
    <blockquote>
      <blockquote>
        <p>Key1 = ['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z',' ']</p>
      </blockquote>
    </blockquote>
  </blockquote>
  
  <pre><code>print(''.join(Key1))
  </code></pre>
  
  <blockquote>
    <blockquote>
      <blockquote>
        <p>Key1 = ['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z',' ']  &lt;---- THIS IS WHAT I DO NOT WANT</p>
      </blockquote>
    </blockquote>
  </blockquote>
  
  <p>However….</p>
  
  <p>If in a separate simple python file (called DOG.py) I execute the following commands on a list: </p>
  
  <p>Key1 = ['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z',' ']</p>
  
  <p>print(Key1)</p>
  
  <blockquote>
    <blockquote>
      <blockquote>
        <p>['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', ' ']</p>
      </blockquote>
    </blockquote>
  </blockquote>
  
  <p>print(''.join(Key1))</p>
  
  <blockquote>
    <blockquote>
      <blockquote>
        <p>ABCDEFGHIJKLMNOPQRSTUVWXYZ    &lt;---- THIS IS WHAT I WANT</p>
      </blockquote>
    </blockquote>
  </blockquote>
  
  <p>The Issue/Question</p>
  
  <p>I ultimately want the output that looks like “ABCDEFGHIJKLMNOPQRSTUVWXYZ”, but for the life of me I cannot figure out how to read in a list for a file and then convert that list to a single string of characters. Can someone tell me where I am going wrong and also show me some code that would fix my problem?</p>