title: Convert command line arguments to regular expression
body: <p>Say, for example, I want to know whether the pattern "\section" is in the text "abcd\sectiondefghi". Of course, I can do this:</p>
  
  <pre><code>import re
  
  motif = r"\\section"
  txt = r"abcd\sectiondefghi"
  pattern = re.compile(motif)
  print pattern.findall(txt)
  </code></pre>
  
  <p>That will give me what I want. However, each time I want to find a new pattern in a new text, I have to change the code which is painful. Therefore, I want to write something more flexible, like this (<code>test.py</code>):</p>
  
  <pre><code>import re
  import sys
  
  motif = sys.argv[1]
  txt = sys.argv[2]
  pattern = re.compile(motif)
  print pattern.findall(txt)
  </code></pre>
  
  <p>Then, I want to run it in terminal like this:</p>
  
  <pre><code>python test.py \\section abcd\sectiondefghi
  </code></pre>
  
  <p>However, that will not work (I hate to use <code>\\\\section</code>).</p>
  
  <p>So, is there any way of converting my user input (either from terminal or from a file) to python raw string? Or is there a better way of doing the regular expression pattern compilation from user input?</p>
  
  <p>Thank you very much.</p>