R15.49 to (R, 15.49) 或
R15.49 to (R, 15.49)
ZAR15.49 to (ZAR, 15.49)
here 并实现了以下功能:
def splitCurrency(string): match = re.search(r'([\D]+)([\d,]+)', string) output = (match.group(1), match.group(2).replace(',','')) return output
但我得到了(R,15)或(ZAR,15)。它忽略了小数点后的数字