Answers for "split string in substring python"

26

how to split a string by character in python

def split(word): 
    return [char for char in word]  
      
# Driver code 
word = 'geeks'
print(split(word)) 

#Output ['g', 'e', 'e', 'k', 's']
Posted by: Guest on December-07-2019
0

python split string after substring

my_string="hello python world , i'm a beginner "
print my_string.split("world",1)[1]

#split takes the word(or character) to split on and optionally a limit to the number of splits.
#In this example split on "world" and limit it to only one split.
Posted by: Guest on October-18-2021

Code answers related to "split string in substring python"

Python Answers by Framework

Browse Popular Code Answers by Language