Answers for "get words from string python"

2

how to get words from a string in python

sentence = "How are you feeling today"
sentence = sentence.split() # this returns list of words
# output = ["How", "are", "you", "feeling", "today"]
Posted by: Guest on January-30-2021
0

extract first word from string in column into a list in python

# Split a phrase in all rows of a column and make a list of the first word

list_data = [dataset_name.column_name.str.split(' ')[index][0]
             for index in range(0, len(dataset_name))]
print(list_data)
Posted by: Guest on April-24-2020

Code answers related to "get words from string python"

Python Answers by Framework

Browse Popular Code Answers by Language