mystr = ' hello world and gzy and java and python ' # 删除左侧空白字符 str1 = mystr.lstrip() print(str1) # 删除右侧空白字符 str2 = mystr.rstrip() print(str2) # 删除两侧空白字符 str3 = mystr.strip() print(str3)