【问题标题】:First Letter separated and capitalized第一个字母分开并大写
【发布时间】:2014-07-20 23:14:38
【问题描述】:

首字母分隔和大写(python 3)

假设我们有这句话: “上帝看着他所造的每一件事,都非常好。晚上和早上是第六天。”

输出: A G S E T T H H M A B I W V G A T E A T M W T S D

其实我知道怎么做,但是不知道怎么做 1 Line

【问题讨论】:

    标签: python python-3.x


    【解决方案1】:
    >>> s = "And God saw every thing that he had made, and, behold, it was very good. And the evening and the morning were the sixth day."
    >>> ' '.join([i[0].upper() for i in s.split()])
    'A G S E T T H H M A B I W V G A T E A T M W T S D'
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-09-01
      • 2018-07-08
      • 2021-03-10
      • 1970-01-01
      • 1970-01-01
      • 2020-12-10
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多