Answers for "split word in 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
24

split string python

file='/home/folder/subfolder/my_file.txt'
file_name=file.split('/')[-1].split('.')[0]
Posted by: Guest on April-01-2020
1

split word python

# How to spit a word :

text = "Word"
text_list = list(text)
print(text_list)

# Output :
# ["W", "o", "r", "d"]
Posted by: Guest on January-30-2021
0

how to split word in python

text= "I am Batman"
splitted_text= text.split()

Print(splitted_text)
Posted by: Guest on September-02-2020

Python Answers by Framework

Browse Popular Code Answers by Language