import osimport arcgisscriptinggp=arcgisscripting.create()coordsys=r"C:\Winx86\ArcGIS\Coordinate Systems\Geographic Coordinate Systems\Asia\Xian 1980.prj"root=r"c:\需要设置投影的目录"for p,dirname,filename in os.walk(root): for name in filename: ext=os.path.splitext(name)[1] if ext==".tif": test=os.path.join(p,name) print test gp.defineprojection(test,coordsys) print "DONE!"