Create for loop for naming output file Python
Question: So i'm importing a list of names e.g.

Textfile would include:

    
    
    Eleen
    Josh
    Robert
    Nastaran
    Miles
    
    my_list = ['Eleen','Josh','Robert','Nastaran','Miles']
    

Then i'm assigning each name to a list and I want to write a new excel file
for each name in that list.

    
    
    #1.   Is there anyway I can create a for loop where on the line:
    temp = os.path.join(dir,'...'.xls')
    _________________________  
    def high_throughput(names):
        import os
        import re
    
    
    # Reading file
    
    in_file=open(names,'r')
    dir,file=os.path.split(names)
    temp = os.path.join(dir,'***this is where i want to put a for loop 
    for each name in the input list of names***.xls')
    out_file=open(temp,'w')
    
    data = []
    
    for line in in_file:
        data.append(line)
    
    in_file.close()
    


Answer: Take a look at [`openpyxl`](http://pythonhosted.org/openpyxl/), especially if
you need to create `.xlsx` files. Below example assumes the Excel workbooks
are created as blank.

    
    
    from openpyxl import Workbook
    names = ['Eleen','Josh','Robert','Nastaran','Miles']
    for name in names:
        wb = Workbook()
        wb.save('{0}.xlsx'.format(name))
    

