Skip to content

Commit

Permalink
W1401: Anomalous backslash in string: '\d'. String constant might be …
Browse files Browse the repository at this point in the history
…missing an r prefix. (anomalous-backslash-in-string)
  • Loading branch information
oneananda committed Oct 24, 2024
1 parent 442c2d2 commit 954edf9
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions 0005-Regular-Expressions-Search/regex_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,10 @@
RESULT = re.search(r'cat|dog|parrot', 'I have a zebra')
print(bool(RESULT)) # Output: False

print('\d : Matches any digit (equivalent to [0-9])')
print('Slash \d : Matches any digit (equivalent to [0-9])')

RESULT = re.search(r'\d', 'Hello 123')
print(bool(RESULT)) # Output: True

RESULT = re.search(r'\d', 'Hello')
print(bool(RESULT)) # Output: False



0 comments on commit 954edf9

Please sign in to comment.