import re my_string = "The value of the float is 2.5. The int's value is 2.\n"m = re.search("^(.*?)\.\s", my_string)if m: print(m.group(1))
Standard input is empty
The value of the float is 2.5
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!