remove whitespace in middle of string python code example Example: python delete white spaces sentence = ' hello apple' sentence.strip() >>> 'hello apple'