第一封信分开并大写

时间:2014-07-20 23:14:39

标签: python python-3.x

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

我们说这句话: "上帝看到了他所做的每件事,而且,这是非常好的。傍晚和早晨是第六天。"

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

其实我知道怎么做,但不知道如何在1行

1 个答案:

答案 0 :(得分:3)

>>> 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'