Created a script just to test how to split text using Python. First I have to split on the delimiter ‘__’, then on the ‘.’.
#!/usr/bin/python
propertyFilename="commons-ear__R01_INC_002.properties"
print propertyFilename
versionWithFileExt = propertyFilename.split('__')
print versionWithFileExt
version = versionWithFileExt[1].split('.')
print version
#And to get the final string
print version[0]
Not that hard, but what confused me when reading the Python documentation was that str.split() is deprecated. But as it turned out, that is in version 2.7, currently we are using 2.4, find out by issuing the command
ls -l /usr/bin/python*
From version 2.7 you should instead use stringObject.rpartition(sep), see more at about.com




