![](https://img-blog.csdnimg.cn/20201014180756918.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
python
裸奔的大金毛
这个作者很懒,什么都没留下…
展开
-
python列表中的所有值转换为字符串,以及列表拼接成一个字符串
>>> ls1 = ['a', 1, 'b', 2]>>> ls2 = [str(i) for i in ls1]>>> ls2['a', '1', 'b', '2']>>> ls3 = ''.join(ls2)>>> ls3'a1b2'原创 2018-07-05 10:44:37 · 44262 阅读 · 1 评论 -
Python一个字符串用空格隔开
# 将字符中单词用空格隔开# 已知传入的字符串中只有字母,每个单词的首字母大写,# 请将每个单词用空格隔开,只保留第一个单词的首字母大写传入:“HelloMyWorld”# 返回“Hello my world”# 给定一个字符串inStr = "HelloMyWorld"# 把字符串转换成列表str_list = list(inStr)# 用循环取出每一个元素for i in inStr: ...原创 2018-07-05 10:58:37 · 15905 阅读 · 1 评论