Answers for "split string multiple times on list of indexes python"

12

how to split a string in python with multiple delimiters

>>> a='Beautiful, is; better*thannugly'
>>> import re
>>> re.split('; |, |*|n',a)
['Beautiful', 'is', 'better', 'than', 'ugly']
Posted by: Guest on June-09-2020
0

split text on multiple separators and put into a list

use regex::Regex; 

fn main() {
    // split text on multiple separators and put into a list
    let q = "The quick brown fox jumps over the lazy dog's back";
    let separator = Regex::new(r"([ ,.]+)").expect("Invalid regex");
    let words: Vec<_> = separator.split(q).into_iter().collect();
    println!("{:?}", words);
}
Posted by: Guest on June-29-2021

Code answers related to "split string multiple times on list of indexes python"

Python Answers by Framework

Browse Popular Code Answers by Language