>>> import os >>> newbase = r"C:\xyz\yyy\S12_G16_V00_ULABSH10_00.shp" >>> y = os.path.split(newbase) >>> print y ('C:\\xyz\\yyy', 'S12_G16_V00_ULABSH10_00.shp') >>> print y[0] C:\xyz\yyy >>> print y[1] S12_G16_V00_ULABSH10_00.shp >>> z = y[1].split('_') >>> print z ['S12', 'G16', 'V00', 'ULABSH10', '00.shp'] >>> print z[0] S12 >>>
base("%Input Features%")
def base(filename): import os y = os.path.basename(filename) return y[:y.rfind(".")]
Los miembros registrados pueden publicar, seguir actualizaciones y más. ¿Nuevo aquí? Regístrate gratis.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.