I want to remove all spaces from a string.
" as fa sdf sdfsdf "
The result would be:
"asfasdfsdfsdf"
There are several ways I can think of to achieve this, and I'm wondering which one is the best.
1.
"".join(" as fa sdf sdfsdf ".split())
2.
" as fa sdf sdfsdf ".replace(" ", "")
And I assume that there are more.
Which one is preferred?