python遍历文件
# 例:遍历d盘下的所有文件夹及文件
import os
import arcgisscripting
gp = arcgisscripting.create()
# 遍历d盘下的所有文件夹及文件
for root, dirs, files in os.walk('F:\shp'):
for name in files:
inText=os.path.join(root,name)
inSep="."
shpname=name.replace('.txt','.shp')
onlyname=name.replace('.txt','')
#print os.path.join(root,name)
strms=os.path.join(root,shpname)
#print inText
#print strms
#print shpname
print onlyname
#gp.CreateFeaturesFromTextFile(inText, inSep, inText, "#")