1.字符串序列翻转 ---- 字符串切片
a_str = “abc”[::-1]
2.字符串分割:
b_str = ‘ ds fdf ds ’
b_str .split(" 空格")
3.字符串拼接
c_str = ' '
c_str .join(列表)
实例方法代码:
def reverse_str(str_input):
new = []
after_split = str_input.split(" ")
for split_i in after_split:
if split_i != "":
a_str = split_i[::-1]
new.append(a_str)
ouput = ' '.join(new)
print(ouput)