python字符串去除空格
- strip()方法
str1 = “a b c”
str1.strip() - replace()方法
replace(old, new, count)
str2 = ‘a b c’
str2.replace(" ", “”) - join()和split()方法
str3 = ‘a b c’
str4 = str3.split() #str4 [‘a’, ‘b’, ‘c’]
str5 = “”.join(str4) # str5 “abc”
相关推荐
rush$0522:转正名单没进,大概率本来就没打算留你