There are lots of ways to do this ranging from changing the regexp to return more groups to reconstructing the string.
One way:
Code:
if mg is None:
return no_page_read_str
date = mg.group(1)
date = "{1}/{0}/{2}".format(*date.split('/'))
pct = mg.group(2)
EDIT: The *date stuff unpacks the list (array) into positional parameters as required by the "format" method. It is explained
in the python docs here.
Another way, less magic:
Code:
if mg is None:
return no_page_read_str
date = mg.group(1)
parts = date,split('/')
date = parts[1] + '/' + parts[0] + '/' + parts[2]
pct = mg.group(2)