title: How to encode a single string in python
body: <p>What I want to do is:</p>
  
  <p>I have a directory name and file name. I want to add them to a URL and make a URL call. Lets say the directory is</p>
  
  <pre><code>D:/somedir/userdata/scripts
  </code></pre>
  
  <p>and the file name is myscript.txt </p>
  
  <p>I want to add these as parameters to URL call but I want to encode them separately and not as key value pair. What I want is a function which can take input like:</p>
  
  <pre><code>D:/somedir/userdata/scripts
  </code></pre>
  
  <p>and return output like:</p>
  
  <pre><code>D%3A%2Fsomedir%2Fuserdata%2Fscripts
  </code></pre>