+ 1
How do I split an input
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.
0
In what language?