Split() function uses whitespace string as separator and removes the empty strings, so I think there is no use using strip() or rstrip() function to remove extra whitespace in head or tail. And here is my example:
a = ' \n 1 2 3 4 \n\n 5 \n\n \t'
b = a.rstrip().split()
c = a.split()
print('b =',b)
print('c =',c)
Run Code Online (Sandbox Code Playgroud)
The result turns out to be:
b = ['1', '2', '3', '4', '5']
c = ['1', '2', '3', '4', '5']
Run Code Online (Sandbox Code Playgroud)
It …