title: Client Server TCP in Python 'bytes' object has no attribute 'encode'
body: <p>Im trying to create a client server, where server stores list of strings and client keeps asking if user wants another one till they indicate no. Im trying to figure out how to send the whole list over and how to iterate it properly. In my client I get the error 'bytes' object has no attribute 'encode' which is the "clientSocket.send(msg.encode())" part.</p>
  
  <p><strong>Server</strong></p>
  
  <pre><code>from random import choice
  import socket
  Port =13000
  Server= socket.socket(socket.AF_INET, socket.SOCK_STREAM)
  Server.bind((socket.gethostname(),Port))
  Server.listen(1)
  print ("The server is ready to recieve ")
  
  quotes = ["Not my circus, not my monkeys",
           "Don't eat yellow snow",
           "Where's Waldo?"]
  
  while True:
      connectionSocket, addr = Server.accept()
      sentence = connectionSocket.recv(2048)
      for i in range (len(quotes)):
          connectionSocket.sendall(quotes.encode())
      **new edit**
      for i in quotes:
          connectionSocket.sendall(i.encode())
  
  Server.close()
  </code></pre>
  
  <p><strong>Client</strong></p>
  
  <pre><code>from random import choice
  import socket
  
  serverName = socket.gethostname()
  Port=13000
  clientSocket = socket.socket(socket.AF_INET,socket.SOCK_STREAM)
  clientSocket.connect((serverName,Port))
  msg = "Quote is: "
  while True:
      clientSocket.send(msg.encode())
      msg = clientSocket.recv(2048)
      print(msg.decode())
  
      x = input(("Would you like another quote? Type 'yes' or 'no' "))
      if x =='yes':
         pass
      elif x == 'no':
          print ("Thanks for using me, bye! ")
          quit()
      else:
          print("Invalid input try again")
  
  
  clientSocket.close()
  </code></pre>