#英文字串首字母改为大写
st = "string"
St = st[0].upper() + st[1:]

 

2016-10-22

后来了解到 python 内部有相关实现,感觉 python 好贴心~~~

>>> "hehe he hehe".capitalize()
'Hehe he hehe'

>>> "hehe he hehe".title()
'Hehe He Hehe'

  

相关文章:

  • 2021-06-19
  • 2022-02-06
  • 2021-09-23
  • 2022-12-23
  • 2021-07-21
  • 2022-01-10
  • 2022-12-23
  • 2021-12-28
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案