dir1 = 'C:\\\\Users\\\\ekloog\\\\Documents\\\\$Doc\\\\3.PostDoc\\\\3.1.Projetcs\\\\3.1.3.TEMP_MODELS\\\\3.1.1.1.Raw_data\\\\MODIS_TEMP\\\\daily_stmp'
dir2 = 'C:\\\\Users\\\\ekloog\\\\Documents\\\\$Doc\\\\3.PostDoc\\\\3.1.Projetcs\\\\3.1.3.TEMP_MODELS\\\\3.1.1.4.Work\\\\2.Gather_data\\\\metdbf_shp'
dir3 = 'C:\\\\Users\\\\ekloog\\\\Documents\\\\$Doc\\\\3.PostDoc\\\\3.1.Projetcs\\\\3.1.3.TEMP_MODELS\\\\3.1.1.4.Work\\\\2.Gather_data\\\\metshp_utm_proj'

for d in range(1, 365):
    ofile = open('cn{0:03}.py'.format(d), 'w')
    ofile.write('# ---------------------------------------------------------------------------\n')
    ofile.write('# cn{0:03}.py\n'.format(d))
    ofile.write('# Created on: 2011-04-25 13:31:26.00000\n')
    ofile.write('#   (generated by ArcGIS/ModelBuilder)\n')
    ofile.write('# Description:\n')
    ofile.write('# ---------------------------------------------------------------------------\n')
    ofile.write('\n')
    ofile.write('# Import arcpy module\n')
    ofile.write('import arcpy\n')
    ofile.write('\n')
    ofile.write('# Local variables:\n')
    ofile.write('a2003_{0:03}_dbf = "{1}\\\\a2003_{0:03}.dbf"\n'.format(d, dir1))
    ofile.write('a2003_{0:03}_layer = "a2003_{0:03}_layer"\n')
    ofile.write('a2003_{0:03}_shp = "{1}\\\\a2003_{0:03}.shp"\n'.format(d, dir2))
    ofile.write('a2003_{0:03}_prj = "{1}\\\\a2003_{0:03}.shp"\n'.format(d, dir3))
    ofile.write('\n')
    ofile.write('arcpy.MakeXYEventLayer_management(a2003_{0:03}_dbf, "X", "y", a2003_{0:03}_layer, "ZZ")\n'.format(d))
    ofile.write('\n')
    ofile.write('arcpy.FeatureToPoint_management(a2003_{0:03}_layer, a2003_{0:03}_shp, "CENTROID")\n'.format(d))
    ofile.write('\n')
    ofile.write('\n')
    ofile.write('arcpy.Project_management(a2003_{0:03}_shp, a2003_{0:03}_prj, "JJ")\n'.format(d))