python清除空格函数
python清除空格函数
mystr = ' hello world and itcast and itheima and Python '
# lstrip() 删除字符串左侧空白字符
print(mystr.lstrip()) # hello world and itcast and itheima and Python
# rstrip() 删除字符串右侧空白字符
print(mystr.rstrip()) # hello world and itcast and itheima and Python
# strip() 删除字符串两侧空白字符
print(mystr.strip()) # hello world and itcast and itheima and Python