python去除字符串中间空格的⽅法1、使⽤字符串函数replace
1 a = 'hello world'
place('', '')
3# 'helloworld'
2、使⽤字符串函数split
1 a = ''.join(a.split())
2print(a)
3# helloworld
3、使⽤正则表达式
1import re
2 strinfo = repile()
3 strinfo = repile('')
4
5 b = strinfo.sub('', a)
6print(b)
7# helloworld
4、int(对于数字)
content = input("请输⼊内容:").strip() #可输⼊1 + 3
# print(''.join(content.split()))
index = content.find("+")
a = content[0:index]
python 正则表达式 空格b = content[index+1:]
print(int(a)+int(b))  #转化以后,⾃动去除空格