Rodrigo
Rodrigo

Reputation: 321

DeprecationWarning: invalid escape sequence \D

I got a warning regarding depreciation of \D, how can I update my code? (bellow) to remove the warning?

re.sub("\D", "", value)

Upvotes: 1

Views: 683

Answers (1)

Rodrigo
Rodrigo

Reputation: 321

Solved with

str(value).translate(str.maketrans("", "", string.punctuation))

Upvotes: 1

Related Questions