text = input("请粘贴您需要转换的文本n")
function = int(input("请输入您想实现的功能:删除空格、中英文标点替换、英文单词功能大写、删除空格并替换中文标点 1/2/3/4n"))
if function == 1:
new_text = text.replace(" ","")
elif function==2:
new_text = text.replace(",",",")
elif function==3:
print("文本首字母大写为")
new_text1 = text.capitalize()
print(new_text1)
print("文本内每个首字母大写")
# new_text2 = text.split(" ")
new_text3 = text.title()
print(new_text3)
print("文本全部转换为大写为")
new_text = text.upper()
elif function==4:
text1 = text.replace(" ","")
text2 = text1.replace(",",",")
text3 = text2.capitalize()
new_text = text3
print(new_text)
运行结果:



