Learn Before
Code

RegEx \d Code Example

import re txt = "1Cademy rocks!" #Check if txt contains any digits (numbers from 0-9): x = re.findall("\d", txt) print(x) if x: print("Match!") else: print("No match") #Since txt contains "1", it will print "Match!"

0

1

Updated 2021-08-24

Tags

Python Programming Language

Data Science