title: Swapping positions when reading a txt file
body: <p>I am reading a csv or txt file.</p>
  <p>The csv or txt file has this format (can have several lines in the same format):</p>
  <pre><code>character , Int, character
  </code></pre>
  <p>And I want to change it to this format:</p>
  <pre><code>character , character , Int
  </code></pre>
  <p>and then save the new file as txt or csv.</p>
  <p>I have this code to read a csv or txt file.</p>
  <pre><code>a_list=open(file)
  for line in a_list:
    #line[1], line[2] = line[2], line[1] # Tried this line but didnt work
    print(line)
  </code></pre>
  <p>And I get this as result:</p>
  <pre><code>A,10,B
  C,13,D
  </code></pre>
  <p>I want to change it to:</p>
  <pre><code>A,B,10
  C,D,13
  </code></pre>
  <p>Whats the best way to do it?</p>
  <p><strong>SOLUTION</strong></p>
  <p>Using @DarrylG answer I changed the code to:</p>
  <pre><code>with open('edges.txt') as f:
      mylist = [line.rstrip('\n') for line in f]
      for line in mylist:
          line = line.split(',')              
          line[1], line[2] = line[2], line[1]  
          line = ','.join(line)               
          print(line) 
  </code></pre>