Toggle navigation
English
Chinese
Python Sandbox
Please refer to
this tutorial
to find more details on the following codes.
# # This code finds multiple matches. # # "Find all decimal numbers (such as 1.72, 22.66) in a sentence." # import re line = "In my supermarket, chicken costs 1.72 dollars/pound and wine costs 22.66 dollars/bottle" match = re.findall( '\d+\.\d+', line) if match: print(match) else: print("No match!")
Run
List