title: How to create raw string from string variable in python?
body: <p>You create raw string from a string this way:</p>
  
  <pre><code>test_file=open(r'c:\Python27\test.txt','r')
  </code></pre>
  
  <p>How do you create a raw variable from a string variable, such as</p>
  
  <pre><code>path = 'c:\Python27\test.txt'
  
  test_file=open(rpath,'r')
  </code></pre>
  
  <p>Because I have a file path:</p>
  
  <pre><code>file_path = "C:\Users\b_zz\Desktop\my_file"
  </code></pre>
  
  <p>When I do:</p>
  
  <pre><code>data_list = open(os.path.expandvars(file_path),"r").readlines()
  </code></pre>
  
  <p>I get: </p>
  
  <pre><code>Traceback (most recent call last):
    File "&lt;pyshell#32&gt;", line 1, in &lt;module&gt;
      scheduled_data_list = open(os.path.expandvars(file_path),"r").readlines()
  IOError: [Errno 22] invalid mode ('r') or filename: 'C:\\Users\x08_zz\\Desktop\\my_file'
  </code></pre>