title: reading all the text files from directory
body: <p>I am new to python and I am using following code to pull output as sentiment analysis:</p>
  
  <pre><code>import json
  from watson_developer_cloud import ToneAnalyzerV3Beta
  import urllib.request
  import codecs
  import csv
  import os
  import re
  import sys
  import collections
  import glob
  ipath = 'C:/TEMP/' # input folder
  opath = 'C:/TEMP/matrix/' # output folder
  reader = codecs.getreader("utf-8")
  tone_analyzer = ToneAnalyzerV3Beta(
      url='https://gateway.watsonplatform.net/tone-analyzer/api',
      username='ABCID',
      password='ABCPASS',
      version='2016-02-11')
  path = 'C:/TEMP/*.txt'   
  file = glob.glob(path)
  text = file.read()
  data=tone_analyzer.tone(text='text')
  for cat in data['document_tone']['tone_categories']:
      print('Category:', cat['category_name'])
      for tone in cat['tones']:
          print('-', tone['tone_name'],tone['score'])
          #create file
  </code></pre>
  
  <p>In the above code all I am trying to do is to read the file and do sentiment analysis all the text file stored in C:/TEMP folder but I keep getting and error :'list' object has no attribute 'read'</p>
  
  <p>Not sure where I am going wrong and I would really appreciate any help with this one. Also, is there a way i can write the output to a CSV file so if I am reading the file </p>
  
  <p>ABC.txt and I create a output CSV file called ABC.csv with output values.</p>
  
  <p>Thank You</p>