title: I want to convert multiple text file (delimited) to separate Excel using Python in a loop
body: <p>I have a folder in which there are 128 .txt files and all of them have delimited data that is to be converted into separate Excel files.</p>
  
  <p>I have the code to convert one text file to excel file but I want that all the files should be converted to excel file automatically and saved with the same name.</p>
  
  <p>I am using the following code:</p>
  
  <pre><code>import xlwt
  import xlrd
  f = open('Events.txt', 'r+')
  row_list = []
  for row in f:
     row_list.append(row.split('|'))
  column_list = zip(*row_list)
  workbook = xlwt.Workbook()
  worksheet = workbook.add_sheet('Sheet1')
  i = 0 
  for column in column_list:
      for item in range(len(column)):
          worksheet.write(item, i, column[item])
      workbook.save('Excel.xls')
      i+=1
  </code></pre>
  
  <p>All the files are stored in the same folder. I am unable to make a loop in which it will open the text file one by one and convert it to excel and save it with the same name as that of text file and then select second text file and so on for 128 files.</p>
  
  <p>Please help!</p>
  
  <p>Thank you in advance</p>