Post

PythonPython

v
veerubhotla sowmithri

Posted on 28th January 2023|18 views

0
votes

Split By Multiple Delimiters Python

How to break a string with multiple delimiters in python?

Answers
P
rushi chowdary

Posted on 28th January 2023

b= ‘something, is; better*than\nnothing’

import re

print(re.split('; |, |\*|\n', b)

Output: ['something', 'is', 'better', 'than', 'nothing']

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