If I have a string that contains decimal values, how can I split it to keep the decimals intact?
For example:
Rhino123.45Python987.654
I want the results to look like this:
[R,h,i,n,o,123.45,P,y,t,h,o,n,987.654]
This is the closest I could get:
import re
string = "Rhino123.45Python987.654"
strChar = re.findall(r’\d+|\D’,string)
print strChar
…but the numbers are fractured at the decimal point:
[‘R’, ‘h’, ‘i’, ‘n’, ‘o’, ‘123’, ‘.’, ‘45’, ‘P’, ‘y’, ‘t’, ‘h’, ‘o’, ‘n’, ‘987’, ‘.’, ‘654’]
Thanks,
Dan