I have a string pattern (for a xml
test reporter) in the following pattern:
'testsets.testcases.[testset].[testcase]-[date-stamp]'
For example:
a='testsets.testcases.test_different_blob_sizes.TestDifferentBlobSizes-20150430130436'
I know I always can parse the testset
and testcase
names by doing:
temp = a.split("-")[0]
current = temp.split(".")
testset = '.'.join(current[:-1]) + ".py"
testcase = current[-1]
However, I want to accomplish that using a more pythonic way, like regex
or any other expression that I would do it in a single line. How can I accomplish that?