Answers for "re for str to remove punctuation"

1

can you edit string.punctuation

>>> from string import punctuation
>>> from re import sub
>>> 
>>> string = "\Fred-Daniels!"
>>> translator = str.maketrans('','', sub('\-', '', punctuation))
>>> string
'\\Fred-Daniels!'
>>> string = string.translate(translator)
>>> string
'Fred-Daniels'
Posted by: Guest on November-27-2020
-1

replace all punctuation in string java

inputString.replaceAll("\\p{Punct}", "");
Posted by: Guest on December-25-2019

Code answers related to "re for str to remove punctuation"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language