python去除字符串首尾的空格时间:2025-02-11 11:34:26strip是trim掉字符串两边的空格。 lstrip, trim掉左边的空格 rstrip, trim掉右边的空格 theString = ' /postlist ' print theString.strip() # /postlist