title: Mergelog program
body: <p>I need help creating a program that can merge two files, and return information about user activity. </p>
  
  <p>I have to create a took that takes parameters, two file names, and a user name that will then merge the two lists and print out in chronological order the activities of the given user. 
  Say there were several users in the log file, it should be able to ask for one and then print out in order that persons activity, can anyone help please? 
  Here's what i have:</p>
  
  <pre><code>def main():
    l1, l2 = rFile()
    sLogs = sortLogs(l1, l2)
    printLogs(sLogs)
  
  
  def printLogs(log):
    for i in range(0, len(log), 1):
      print("sLogs["",i,": ", log[i], end="", sep="")
  
  def rFile():
    l1Name = input("First file to read: ")
    l2Name = input("Second file to read: ")
    log1 = read(l1Name)
    log2 = read(l2Name)
    return log1, log2
  
  def read(fname):
    return open(fname, "r").readlines()
  
  def sortLogs(log1, log2):
    mLog = log1 + log2
    for i in range(0, len(mLog), 1):
      for j in range(i, len(mLog), 1):
        if(mLog[i] &gt; mLog[j]):
        temp = mLog[j]
        mLog[j] = mLog[i]
        mLog[i] = temp
    return mLog
  
  main()
  </code></pre>
  
  <p>The problem im having is taking a username and only printing out that user's activity</p>
  
  <p>The log files are formatted the same way, like below:</p>
  
  <pre><code>12:34:23 Whom Logged In 
  13:12:23 Who Opened Terminal
  14:23:23 Who Logged Out
  </code></pre>
  
  <p>etc..</p>
  
  <p>I know you could sort them by tokens, which if you use a "" as the token seperator you can do it by the first token, which would be the time, but im not quite sure how to write that exactly</p>