语法为:变量名.title()
使用此方法,可以将变量中每个单词的首字母改为大写。
#修改字符串的大小写
name = 'donald trump'
print(name.title())
输出结果为:
Donald Trump