title: How do I make changes to a list that is stored in a txt file?
body: <pre><code>    studentList=[]
  
  reading=True
  
  readList=open("test10.4.3.txt","r")
  
  for item in readList:
      studentList.append(item)
  for item in studentList:
      print(item)
  input("\nPress ENTER")
  
  menulist=print( "1. Print the list",
          "2. Add a name to the list",
          "3. Remove a name from the list",
          "4. Change an item in the list",
          "9. Quit")
  
  def menu():
      aMenu=input("please select a number")
      return aMenu
  t=True
  while t:
      target=menu()
      if target=="1":
          print(studentList)
      if target=="2":
          Addname=input("Type in a name and major to add:")
          list=list.append(Addname)
          print(menulist)
      if target=="3":
          Removename=input("What name and major would you like to remove:")
          list=list.remove(Removename)
          print(menulist)
      if target=="4":
          Changename=input("What name and major would you like to change:")
          changetoname=input("What is the new name and major:")
          list=list.replace(Changename, changetoname)
          print (menulist)
  
      if target=="9":
          t=False
          print("good bye")
      else:
          print (menulist)
  </code></pre>
  
  <p>So I am trying to make changes to a list that is stored in a txt file. Inside the txt file there are 3 names and those 3 peoples academic majors.Iv written a program that should allow me to make changes (I think, I'm very new to all of this) but I cant get it to run for example when I input 2 to add a name and major it gives me </p>
  
  <pre><code>Traceback (most recent call last):
    File "D:/py/Scripting/class.py", line 52, in &lt;module&gt;
      list=list.append(Addname)
  TypeError: descriptor 'append' requires a 'list' object but received a 'str'
  
  Process finished with exit code 1
  </code></pre>
  
  <p>or when I input 3 to remove a name it gives me </p>
  
  <pre><code>Traceback (most recent call last):
    File "D:/py/Scripting/class.py", line 56, in &lt;module&gt;
      list=list.remove(Removename)
  TypeError: descriptor 'remove' requires a 'list' object but received a 'str'
  </code></pre>
  
  <p>when I input 4 I get </p>
  
  <pre><code>Traceback (most recent call last):
    File "D:/py/Scripting/class.py", line 56, in &lt;module&gt;
      list=list.remove(Removename)
  TypeError: descriptor 'remove' requires a 'list' object but received a 'str'
  </code></pre>
  
  <p>as you can see the errors are more less the same. I cant seem to figure out what I'm doing wrong. Any ideas or examples would be appreciated. </p>