Post

PythonPython

v
veerubhotla sowmithri

Posted on 26th April 2024|55 views

0
votes

Split By Multiple Delimiters Python

How to break a string with multiple delimiters in python?

Answers
P
rushi chowdary

Posted on 26th April 2024

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