title: Printing List as string in python
body: <p>I am newbie to python 
  Want to search for string file if found print line 
  and want to  print output as </p>
  
  <pre><code>"mapp1=2"
  "map2=6"
  "MAP3"
  </code></pre>
  
  <p>Sample code :</p>
  
  <pre><code>import os
  fname = "xx.txt"
  
  new_list=[]
  f=open(fname,'r')
  for line in f :
      key = line.strip().split('\n')
      matching = [s for s in key if ("mapping" or "MAP") in s]
      if matching:
         if not line.startswith("#"):
             new_list.append((key))
  
  print new_list
  
  values = ','.join(str(i) for i in new_list)
  print values
  
  failed_res = ','.join(str(j) for j in values)
  print failed_res
  </code></pre>
  
  <p>Output for this code is:</p>
  
  <pre><code>[mapp1=2],[map2=6],[MAP]
  </code></pre>
  
  <p>Please give some suggestion</p>