title: Checking out books in a library management system
body: <p>I am writing code for a basic library management system, I have a txt file for ID number, book title and then author. I have got to the stage where I have a log in system asking for id numbers etc and I can search for books. Now I need to make it so I can check out the book... I have got it so it will search for the book but then I need to be append the ID number onto the correct book in the txt file. I have got it so at the moment it just appends to the last object. any pointers would be a great help. Thank you. </p>
  
  <p>Present code for searching for books...</p>
  
  <pre><code>while True:
      n=float(raw_input('Please enter your ID '))
      if n in range (1000,10000):
  
      break
  print 'ID is incorrect, please try again'
  
  
  with open("txt.txt") as searchfile:
      found = False
      while not found:
          b=str(raw_input('please enter a book '))
          if b == '':
          break  # allow the search-loop to quit on no input
          for line in searchfile:
              if b in line:
                  print line
                  found = True
                  break
          else:
              print 'Please try again'
              searchfile.seek(0)  # reset file to the beginning for next search
  
  
  searchfile.close()
  </code></pre>
  
  <p>That all works ^^^ then i got to checking out books and got this following code:</p>
  
  <pre><code>find_book=[]
      with open('txt.txt') as input_file:
          lines = [line.rstrip().split('\t')
                   for line in input_file.readlines()]
  
  
  
  if(find_book('0',3))==0:
      print 'availabile' 
  </code></pre>