0

What does the split function do in python?

Ive seen it several times. What does it do?

14th Nov 2017, 3:19 PM
privrax.
privrax. - avatar
4 Answers
+ 4
try: help(str.split)
14th Nov 2017, 5:01 PM
Kuba SiekierzyƄski
Kuba SiekierzyƄski - avatar
+ 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
14th Nov 2017, 3:22 PM
AgentSmith
+ 2
A command like name.split() returns a list. You might consider iterating over that list: for i in name.split(" "): print i
14th Nov 2017, 3:22 PM
MsJ
MsJ - avatar
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
16th Oct 2018, 4:19 AM
rahul kumar
rahul kumar - avatar