Python: Convert a given string into a list of words
Convert string to list of words.
Write a Python program to convert a given string into a list of words.

Sample Solution-1:
Python Code:
Sample Output:
['The', 'quick', 'brown', 'fox', 'jumps', 'over', 'the', 'lazy', 'dog.'] ['The', 'quick', 'brown', 'fox', 'jumps', 'over', 'the', 'lazy', 'dog.']
Sample Solution-2:
- Use re.findall() with the supplied pattern to find all matching substrings.
- Omit the second argument to use the default regexp, which matches alphanumeric and hyphens.
Python Code:
Sample Output:
['The', 'quick', 'brown', 'fox', 'jumps', 'over', 'the', 'lazy', 'dog'] ['Python', 'JavaScript', 'C'] ['build', 'q', 'out', 'one-item']
Flowchart:

For more Practice: Solve these Related Problems:
- Write a Python program to split a sentence into a list of words using the split() method.
- Write a Python program to use regular expressions to convert a string into a list of words, ignoring punctuation.
- Write a Python program to implement a function that returns a list of words from a given string.
- Write a Python program to strip extra whitespace and then convert the input string into a list of words.
Go to:
Previous: Write a Python program to check if a string contains all letters of the alphabet.
Next: Write a Python program to lowercase first n characters in a string.
Python Code Editor:
Contribute your code and comments through Disqus.
What is the difficulty level of this exercise?
Test your Programming skills with w3resource's quiz.