Python - concatenate a string to include a single backslash
<p>In Python 2.6, I need to create a string by concatenating <code>INTRANET\</code> and a userid such as <code>jDoe</code> to obtain a string <code>INTRANET\jDoe</code>. This will string will be a part of a SQL query. I have tried this a number of ways but end up getting <code>INTRANET\\jDoe</code> and hence my query does not return any results.</p>

<p>I want to do this:</p>

<pre><code>a = 'INTRANET\\'
b = 'jDoe'
c = a+b   ### want to get c as 'INTRANET\jDoe', not 'INTRANET\\jDoe'
</code></pre>

<p>Thanks</p>

<hr>

<p>The problem seems a little different:</p>

<p>When I print c, I get 'INTRANET\jDoe'. But when I append c to a list (to be used in a sql query) as below:</p>

<pre><code>list1 = []
list1.append(c)
print list1

&gt;&gt;&gt;['INTRANET\\jDoe']
</code></pre>

<p>Why is this ?</p>
