title: Saving a file or overwriting it if it exists
body: <pre><code>def save_calendar(calendar):
  '''
  Save calendar to 'calendar.txt', overwriting it if it already exists.
  
  The format of calendar.txt is the following:
  
  date_1:description_1\tdescription_2\t...\tdescription_n\n
  date_2:description_1\tdescription_2\t...\tdescription_n\n
  date_3:description_1\tdescription_2\t...\tdescription_n\n
  date_4:description_1\tdescription_2\t...\tdescription_n\n
  date_5:description_1\tdescription_2\t...\tdescription_n\n
  
  Example: The following calendar...
  
      2015-10-20:
          0: Python 
      2015-11-01:
          0: CSC test 2
          1: go out with friends after test
  
  appears in calendar.txt as ...
  
  2015-10-20:Python 
  2015-11-01:CSC test 2    go out with friends after test
  
                          ^^^^ This is a \t, (tab) character.
  
  
  :param calendar:
  :return: True/False, depending on whether the calendar was saved.
  '''
  </code></pre>
  
  <p>So for this function would i simply just do this:</p>
  
  <pre><code>if not os.path.exists(calendar.txt):
      file(calendar.txt, 'w').close()
  </code></pre>
  
  <p>What i'm not understanding is the return true/false, whether the calender was saved. If i created the text file and simply check if it exists shouldn't that be enough?</p>