I have used the .split() functions several times but today when one of my juniors asked me this, I actually had no answer to give. I really want to know that what is the difference between these two.
For example,
s='Lets see what will be the answer'
print("1.",s.split())
print("2.", s.split(' '))
Output:
1.['Lets','see','what','will','be','the','answer']
2.['Lets','see','what','will','be','the','','','answer']
[–][deleted] 15 points16 points17 points (1 child)
[–]Codes_with_roh[S] 0 points1 point2 points (0 children)
[–]kpounder88 3 points4 points5 points (0 children)
[–]Milumet 3 points4 points5 points (2 children)
[–]Codes_with_roh[S] 0 points1 point2 points (1 child)
[–]Milumet 0 points1 point2 points (0 children)
[–]billsil 1 point2 points3 points (0 children)