If your coordinates are c , this will work. Note that this will not work for negative values. Do you also have to deal with negatives?
",+".join(c.rsplit("+", 1))
To work with negatives.
import re parts = re.split("([\+\-])", c) parts.insert(3, ',') print "".join(parts[1:])
OUTPUT
+27.5916,+086.5640'
And for the negatives:
>>> c = "+27.5916-086.5640" >>> parts = re.split("([\+\-])", c) >>> parts.insert(3, ',') >>> "".join(parts[1:]) '+27.5916,-086.5640'
sberry
source share