title: Getting AttributeError: 'str' object has no attribute 'append'
body: <p>I am getting the error:</p>
  
  <blockquote>
    <p>AttributeError: 'str' object has no attribute 'append'</p>
  </blockquote>
  
  <p>However, none of the posts on SO seem to be pertinent to my error. My issue is that I have no idea where my piece of code turns what seems to be an array into a string when appending. </p>
  
  <p>Code:</p>
  
  <pre><code>import os
  import hashlib
  yn = True
  var = []
  
  while yn == True:
      print """
      1. Import from file
      2. Add new cards
      3. Look at the cards
      4. Delete cards  
      5. Modify cards  
      """
      ui = int(raw_input("Which option would you like to choose: "))
      if ui == 1:
          print "The directory is", os.getcwd()
          getcwdui = raw_input("Would you like to change the directory y/n: ")
          if getcwdui == "y":
              os.chdir(raw_input("Where would you like to change it to? Please make sure to include all necessary punctuation: "))
          else:
              print "\n"
          fileui = raw_input("Which file would you like to import?")
          file1 = open(fileui, "r")
          var = file1.read()
          var.split("]")
          file1.close()
  
  #   [id, name, hp, set, setnum, rarity]
  if ui == 2:
      name = raw_input("What is the name of the pokemon: ")
      hp = int(raw_input("What is the hp of the pokemon: "))
      setp = raw_input("What is the set of the pokemon: ")
      setnum = int(raw_input("What is the set number of the pokemon: "))
      rarity = raw_input("What is the rarity of the pokemon: ")
      copies = int(raw_input("How many copies of the card do you have: "))
      m = hashlib.md5()
      hashid = m.update(str(setnum))
      var.append([hashid, name, hp, setp, setnum, rarity])
      file1 = open(raw_input("What file would you like to open: "), "w")
      file1.write(str(var))
      file1.close()
  </code></pre>