title: Program code in Python not working "not in" statement
body: <p>This code is returning the Date not being in the file every time, and I don't know why.</p>
  
  <pre><code>testDate = open("Sales.txt")
  
  #Declaring variables for later in the program
  printNum = 1
  
  newcost = 0
  
  startTestLoop = 1
  
  endTestLoop = 1
  
  #Creating a loop in case input is invalid
  while startTestLoop &gt; 0:
  
      #Asking user for start date
      #startDate = raw_input("Please input the desired start date in the form YYYY,MM,DD: ")
  
  
      #Checking if input is valid, and arranging it to be used later
      try :
          startDate = startDate.strip().split(',')
          startYear = startDate[0]
          startMonth = startDate[1]
          startDay = startDate[2]
          startYear = int(startYear)
          startMonth = int(startMonth)
          startDay = int(startDay)
          startDate = date(startYear, startMonth, startDay)
      #Informing user of invalid input
      except:
          "That is invalid input."
          print
      #EndTry
  
  
  
      #Testing to see if date is in the file, and informing user
      if startDate not in testDate:
          print "That date is not in the file."
      #Exiting out of loop if data is fine 
      else:
          startTestLoop -= 1
          print "Aokay"
      #EndIf
  </code></pre>