title: How can I format strings correctly on a new line for every string I receive from a server
body: <p>So I got a client-server program which encrypts/decrypts strings it receives from a file. The server correctly receives the strings in correct format using .split()</p>
  
  <pre><code>#this is correct
  Geheime bericht 1
  Project PAD
  Wachtwoorden
  </code></pre>
  
  <p>When I want to send that data back in .upper() it results this in the 
  client instead</p>
  
  <pre><code>GEHEIME BERICHT 1PROJECT PADWACHTWOORDEN
  </code></pre>
  
  <p>Using .split() it prints the words on the newline. However the words are not correctly returned. This is the list of the .split()</p>
  
  <pre><code>['GEHEIME', 'BERICHT', '1PROJECT', 'PADWACHTWOORDEN']
  </code></pre>
  
  <p>It should be like this(this is how the client first sends it to the server)</p>
  
  <pre><code>b'Geheime bericht 1\n'
  b'Project PAD\n'
  b'Wachtwoorden'
  </code></pre>
  
  <p>using a for loop on the list prints it like</p>
  
  <pre><code>GEHEIME
  BERICHT
  1PROJECT
  PADWACHTWOORDEN
  </code></pre>
  
  <p>How am I able to solve this? It seems that the main source of the problem occurs when I'm either sending back the decrypted, all capped strings, or when I'm receiving them on the clientside. </p>
  
  <p>Some client-side code:</p>
  
  <pre class="lang-py prettyprint-override"><code>connectie = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
  connectie.connect((ipaddr, portnr))
  
  with open('textinput.txt', 'rb') as inh:
      for lijn in inh:
          enc_data = publickey.encrypt(lijn.strip(), 16)
          print(lijn)
          connectie.send(enc_data[0])#verzend encrypted data
          time.sleep(1)
  
  #ontvang de decrypted data/strings
  decrypt_data = connectie.recv(2048).decode('utf-8')
  </code></pre>
  
  <p>Some server-side code:</p>
  
  <pre class="lang-py prettyprint-override"><code>with clientconnectie:
      print("\nConnectie gemaakt met: " + conninfo[0] + ":" + str(conninfo[1]))
      while True:
          enc_data = clientconnectie.recv(2048)
          if not enc_data:
              break
          #print encrypted data zodat je kan zien dat het encrypted is
          #print(enc_data)
          data = privatekey.decrypt(enc_data)#decrypt ontvangen data
  
  
          #print("\nSuccesvol ontvangen en decrypt op Server:\n" +str(data.decode('utf-8')))
          #verzend de strings/data in uppercase
  
          clientconnectie.send(data.upper()) #it seems that the main problem is caused by this line
  </code></pre>