python split sentence into words
sentence = 'Hello world a b c'
split_sentence = sentence.split(' ')
print(split_sentence)
python split sentence into words
sentence = 'Hello world a b c'
split_sentence = sentence.split(' ')
print(split_sentence)
split string python
file='/home/folder/subfolder/my_file.txt'
file_name=file.split('/')[-1].split('.')[0]
split a string into an array of words in python
string = '1-2-3
array_of_words = string.split('-')
print(array_of_words) # prints ['1', '2', '3']
##################################################
#if you dont pass anything in the split() function,
#the default parameter will be a space
##################################################
string = '1 2 3'
array_of_words = string.split()
print(array_of_words) # prints ['1', '2', '3']
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us