title: How to send a list through TCP sockets - Python
body: <p>I want to send a list through TCP sockets but i can't get the exact list when receiving from the server-side .
  To be more specific say that i have this list:</p>
  
  <pre><code> y=[0,12,6,8,3,2,10] 
  </code></pre>
  
  <p>Then, i send each item of the list like this:</p>
  
  <pre><code> for x in y :
   s.send(str(x))
  </code></pre>
  
  <p>Now the code of server to recieve the data looks like this:</p>
  
  <pre><code> while True:
   data = connection.recv(4096)
   if data:
   print('received "%s"' % data)             
   else:
   print('no more data from', client_address)
   break
  </code></pre>
  
  <p>The problem is that when i run the program i don't get the same list but something like this:</p>
  
  <p>data=[012,6,83,210]</p>
  
  <p>Also, everytime i run the program i get a different result for list data</p>
  
  <p>Any ideas what's going wrong with my code ?</p>