title: write() argument must be str, not bytes
body: <p>I'm a beginner programmer and am working through the book python for the absolute beginner. I have come across a problem trying to write a high scoring function for the trivia game. when the function 'highscore(user, highscore):' is called on I try to assign the arguments accordingly so I can pickle the information to a file for later use. however I am running into an error trying to dump the info needed.</p>
  
  <pre><code>def highscore(user, highscore):
      '''stores the players score to a file.'''
      import pickle, shelve
      user = ''
      highscore = 0
      #Hscore = shelve.open('highscore.dat', 'c')
      Hscore = open('highscore.txt', 'a')
      pickle.dump(user, Hscore)
      pickle.dump(highscore, Hscore)
      #Hscore.sync()
      Hscore.close()
  </code></pre>
  
  <p>since I'm working through the book and have also seen shelves in action I tried using them too but run into their own set of errors. so ignore the '#'s at this time.</p>
  
  <p>at the part pickle.dump is where I'm generating an error. I keep getting (as the title suggests) a write argument error. </p>
  
  <p>I don't understand why its not recognizing them as string. as when they are defined in the main function it is indeed a string..</p>