title: How to append files names with the path in python?
body: <p>I have path variable path = 'C:\Users\Sony\Desktop', now I am finding all the text files in this directory and saving their names in a list by this code :</p>
  
  <pre><code>text_files = [f for f in os.listdir(path) if f.endswith('.txt')]
  print text_files
  </code></pre>
  
  <p>This will give me ['a.txt', 'b.txt', 'k.txt', 'link.txt']</p>
  
  <p>Now I want to open these files one by one to find a word , for tht I need full </p>
  
  <pre><code>url=["C:\Users\Sony\Desktop\a.txt","C:\Users\Sony\Desktop\b.txt","C:\Users\Sony\Desktop\k.txt","C:\Users\Sony\Desktop\link.txt"]
  </code></pre>
  
  <p>how to append path with the file name , when I do url=path+'\'+text_files[0] then I get error , '\' is taken as escape, plz help</p>