title: Handling input with back slashes in python 3
body: <p>I'm working with a file that contains some lines with backslash characters, such as "moz\\123\\". I have each line then stored in a dictionary and later compared to the original line in the file. The problem is that Python inputs into the dictionary a key with double the number of backslashes (instead of "moz\\123\\", I get "moz\\\\123\\\\") so when doing the comparison between the original line and the key in the dictionary, the original cannot be found because the key is different. How can I handle this problem? Here is some code:</p>
  
  <pre><code>my_dict={}
  
  def reader():
  inputfile=open('&lt;filepath&gt;', 'r')
  for line in inputfile:
      my_dict[line]=0
  print(my_dict)
  
  reader()
  </code></pre>
  
  <p>where filepath contains</p>
  
  <pre><code>the
  here
  moz\\12\\14
  the\ 
  </code></pre>
  
  <p>and the print statement gives </p>
  
  <pre><code>{'here\n': 0, 'the\\': 0, 'the\n': 0, 'moz\\\\12\\\\14\n': 0}.
  </code></pre>