title: Python String Input and Output From .txt
body: <p>im working on a chatterbot project that mimicks the user by using a txt file to store the inputs and outputs. But i had come across a problem where it wont compare the input to the file correctly.</p>
  
  <p>here are the lines of code:</p>
  
  <pre><code>  with open('memory.txt', 'r+') as mem:
  #memory.txt is where is store the I/O. ex  "(input)/(output)" helloinput/hellooutput
  
          for line in mem.read():
  #reiterates through each line
  
              if(UI + '/') in line:
  #Here is the problem, where the ui being the user input var is not comparing correct to the memory.txt file line.
  #(yes) the / is needed for it to work and i have tried to str(UI + '/') but still no luck 
  
                  print(line.rsplit('/',1)[0])
  #this prints out everything after the / character
  </code></pre>
  
  <p>Sorry if the question seems a little unclear.</p>