trim command in python code example Example 1: trim string python >>> ' Hello '.strip() 'Hello' Example 2: python trim my_string.strip()