Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

Python cut down OS path to certain part

import os

# I think you will have different jobs/pngs, so pass these variables from somewhere
jobPrefix = 'Job_Cluster_AK_Alaska_'
pngString = 'Job_Cluster_AK_Alaska_Yakutat_CDP.png'

# Split filename/extension
pngTitle = os.path.splitext(pngString)[0]

# Get the filename without the jobPrefix
finalTitle = pngTitle[len(jobPrefix):]
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #Python #cut #OS #path #part
ADD COMMENT
Topic
Name
9+1 =