题解 | #格式化输出(三)#
格式化输出(三)
https://www.nowcoder.com/practice/cc6cb2b4aac446da902356fec043f5c1
import re
str = input()
# print(str.replace(" ", "")) # 利用replace()函数替代
# print(re.sub(r"\s+", "", str)) # 利用正则表达式,其中\s+可表示一个或多个空格
# print("".join(str.split())) # 利用join()函数将字符串中的单词提取出来
print(str.strip()) # 去除前后的空格
# print(str.lstrip()) # 去除左边的空格
# print(str.lstrip()) # 去除右边的空格

