logo-MindMajix
PostPythonPython
S
Sowjanya Kodiganti

Posted on 21st July 2024|17 views

0
votes

Remove Punctuation From String Python

How to remove punctuation marks from a string in Python 3.x?

1 answers
Answers
P
Anusha V

Posted on 21st July 2024| views

You can simply remove all the punctuation by using this

import re, string 

eclean_string = re.sub(rf"[{string.punctuation}]", "", dirty_string)

 

Write your answer

STILL GOT QUERIES?

Get a Live FREE Demo

  • Explore the trending and niche courses and learning maps
  • Learn about tuition fee, payment plans, and scholarships
  • Get access to webinars and self-paced learning videos
Name
Course *
Email *
Phone Number