I want to create a simple string match for a % sign in Python.
Here is my code
import re
a = "5%"
p = re.compile(r'%')
p.match(a)
p.match(a) returns None.
match matches the regexp if it occurs at the beginning of the search string. You want p.search(a).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With