title: Python - Using an operator to assign a file name when using a class
body: <p>I am a somewhat Python/programing newbie, and I am attempting to use a python class for the first time. </p>
  
  <p>In this code I am trying to create a script to backup some files. I have 6 files in total that I want to back up regularly with this script so I thought that I would try and use the python Class to save me writing things out 6 times, and also to get practice using Classes. </p>
  
  <p>In my code below I have things set up for just creating 1 instance of a class for now to test things. However, I have hit a snag. I can't seem to use the operator to assign the original filename and the back-up filename. </p>
  
  <p>Is it not possible to use the operator for a filename when opening a file? Or am I doing things wrong. </p>
  
  <pre><code>class Back_up(object):
      def __init__(self, file_name, back_up_file):
          self.file_name = file_name
          self.back_up_file = back_up_file
          print "I %s and me %s" % (self.file_name, self.back_up_file)
  
          with open('%s.txt', 'r') as f, open('{}.txt', 'w') as f2 % (self.file_name, self.back_up_file):
              f_read = read(f)
              f2.write(f_read)
  
  first_back_up = Back_up("syn1_ready", "syn1_backup")
  </code></pre>
  
  <p>Also, line #7 is really long, any tips on how to shorten it are appreciated.</p>
  
  <p>Thanks
  Darren</p>