How do I split an input | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How do I split an input

28th Feb 2020, 10:53 PM
DrPaid329
2 Answers
+ 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