+ 1

How do I split an input

28th Feb 2020, 10:53 PM
DrPaid329
2 Réponses
+ 1
in Python: Split a string into a list where each word is a list item: txt = input( ) or "Welcome to Hello World!" x = txt. split() print(x) may be a shoter: x = input( ).split( ) You can specify the separator, default separator is any whitespace. syntax: string.split(separator, maxsplit) maxsplit - Specifies how many splits to do.
28th Feb 2020, 11:27 PM
Vitaly Sokol
Vitaly Sokol - avatar
0
In what language?
28th Feb 2020, 11:06 PM
Austin