title: how to format output file in python?
body: <p>I am trying to format my output file exactly like my input file. I was wondering if anyone could give me some pointers. My codes are:</p>
  
  <pre><code>input_file=open('abcd.txt','r')
  
  f1=input('file name: ')
  
  output_file=open(f1,'w')
  for line in input_file:
      output_file.write(line)
  
  input_file.close()
  output_file.close()
  </code></pre>
  
  <p>My input file looks like the following. Where country is 50 chars long, second category is 6 chars, third is 3 chars, fourt is 25 chars, and year is 4 chars long. The following is the inputfile.</p>
  
  <pre><code>Afghanistan                                        WB_LI   68 Eastern Mediterranean     2012
  Albania                                            WB_LMI  90 Europe                      1980
  Albania                                            WB_LMI  90 Europe                    1981
  </code></pre>
  
  <p>The following is how my output file looks like:</p>
  
  <pre><code>Afghanistan                                        WB_LI   68 Eastern Mediterranean     2012
  Albania                                           WB_LMI  90 Europe                    1980
  Albania                                           WB_LMI  90 Europe                    1981
  </code></pre>