如何将列表中元素首字母大写

时间:2021-04-28 20:16:33
【文件属性】:
文件名称:如何将列表中元素首字母大写
文件大小:2KB
文件格式:DOCX
更新时间:2021-04-28 20:16:33
列表 转换大写字母 Python 如何将列表中元素首字母大写 例: n=['banana','apple','peacj'] print(' '.join(n).title().split(' ')) 首先用join将字符串用空格链接转换为字符串 接着用title将首字母大写 最后用split将其转换为列表

网友评论