How to get string formate from response of HTTP GET in Python? : <p>I have the following task </p>

<p>Write a function named "get_response" that three string parameters representing the protocol, name of a server, and a path for an HTTP GET request in this order. Return the response of an HTTPS GET request to the url formed by these inputs. The response should be returned as a string</p>

<p>I wrote the following code. </p>

<pre><code>def get_response(protocol, server, path):
str = protocol + "://" + server + "/" + path
contents = urllib.request.urlopen(str).read()

return contents
</code></pre>

<p>I get the following thing when I run the code</p>

<blockquote>
  <p>b'pupils'</p>
</blockquote>

<p>What the question wants is the string format and only "pupils" in the answer. I try to convert it into str, but it's not working. </p>

<p>Any suggestions?</p>
