03-GDAL batch get image storage location (input)

Usually, if you batch process the data, you need to get the image data path under all file directories, and then process it scene by scene.

The method of obtaining is as follows:

import os
items = os.listdir("G:\mypython3\gdal\data")
newlist = []
for names in items:
	if names.endswith(".img"):
	newlist.append("G:\mypython3\gdal\data"+"\\"+names)

Official help for OS Python package:

https://www.runoob.com/python/python-os-path.html

Or you can:

os.chdir('G:\mypython3\gdal\data\mosaic')
in_files = glob.glob('*.tif')
print(in_files)

Guess you like

Origin blog.csdn.net/suntongxue100/article/details/114250470