Split a given string on asterisk into several substrings and display each substring in Python

In this article, we will write a Python program to Split a given string on asterisk into several substrings and display each substring.

Split a given string on asterisk into several substrings and display each substring in Python

def asterisk(sentence): subStrings = sentence.split('*') for s in subStrings: print(s) asterisk('source*code*examples') asterisk('hello*world*python*program') 

Output:

source code examples hello world python program






Comments