You can also do this in one line using gdal.Info as so:
ds = gdal.Open(path)
epsg = int(gdal.Info(ds, format='json')['coordinateSystem']['wkt'].rsplit('"EPSG","', 1)[-1].split('"')[0])
You can also do this in one line using gdal.Info as so:
ds = gdal.Open(path)
epsg = int(gdal.Info(ds, format='json')['coordinateSystem']['wkt'].rsplit('"EPSG","', 1)[-1].split('"')[0])