If you want to remove all spaces, use str.replace(): sentence = ' hello apple' sentence.replace(" ", "") >>> 'helloapple'.
確定! 回上一頁