-7

My String is:

wish = "Happy New Year"

Output:

word_list = ['Happy','New','Year']
Remi Guan
  • 21,506
  • 17
  • 64
  • 87
Samin
  • 11
  • 1
  • 1
  • 2

2 Answers2

3
>>> wish = "Happy New Year"
>>> wordlist = wish.split()
>>> wordlist
['Happy', 'New', 'Year']
>>>

You can see the help of the string function split.

>>> help(''.split)
Help on built-in function split:

split(...)
    S.split([sep [,maxsplit]]) -> list of strings

    Return a list of the words in the string S, using sep as the
    delimiter string.  If maxsplit is given, at most maxsplit
    splits are done. If sep is not specified or is None, any
    whitespace string is a separator and empty strings are removed
    from the result.

>>>
kvivek
  • 3,321
  • 1
  • 15
  • 17
0

See the split method for the string.

"Happy New Year".split()

This will produce your array.