0
What does the split function do in python?
Ive seen it several times. What does it do?
4 Respostas
+ 4
try:
help(str.split)
+ 3
https://www.tutorialspoint.com/JUMP_LINK__&&__python__&&__JUMP_LINK/string_split.htm
The method split() returns a list of all the words in the string, using str as the separator (splits on all whitespace if left unspecified), optionally limiting the number of splits to num.
Following is the syntax for split() method −
str.split(str="", num=string.count(str)).
Parameters:
str − This is any delimeter, by default it is space.
num − this is number of lines minus one
+ 2
A command like name.split() returns a list. You might consider iterating over that list:
for i in name.split(" "):
print i
0
The split() method in Python splits a string into a list. You can specify the separator, default separator is any whitespace.
http://net-informations.com/python/file/split.htm