How does [\d+] regular expression work in Python?

PythonServer Side ProgrammingProgramming

The following code shows what the regular expression [\d+] does on the given string

[\d+] regular expression refers to one digit (0-9) or + character 

Example

import re
result = re.findall(r'[\d+]', 'Taran123tula+456')
print result

output

['1', '2', '3', '+', '4', '5', '6']
raja
Published on 03-Jan-2018 11:32:24
Advertisements