0
A
回答
9
返回一個字符串,它是在可迭代迭代的字符串的連接。如果seq中有任何非字符串值(包括字節對象),則會引發TypeError。元素之間的分隔符是提供此方法的字符串。
I.e. ''.join(parts)
如描述中所示,這適用於字符串的所有迭代,而不僅僅用於字符列表(單字母字符串)。
1
your_list = ['s', 'c', 'h', 'o', 'o', 'l']
new_string = "".join(your_list)
2
必須已經問/回答了一百萬次,但在這裏它是:
''.join(['s', 'c', 'h', 'o', 'o', 'l'])
1
>>> l=['s', 'c', 'h', 'o', 'o', 'l']
>>> print ''.join(l)
school
0
希望這會幫助你。儘管''.join(['s','c','h','o','o','l'))的作品,我個人喜歡使用下面顯示的方法.. 無論如何,你的電話: )
>>> word
['s', 'c', 'h', 'o', 'o', 'l']
>>> reduce(lambda a,x:a+x,word)
'school'
>>>
相關問題
- 1. 在單詞中匹配單詞Python
- 2. (Python)中的單詞大寫?
- 3. Python中的頻繁單詞
- 4. NLTK詞彙中缺少單詞 - Python
- 5. 在Python中計數單詞
- 6. 在Python中回顯單詞
- 7. Python:如何在單詞表中找到混雜的單詞
- 8. 我如何知道python中的單詞有多少個單詞?
- 9. 如何在Python中找到單詞旁邊的單詞
- 10. Python/pandas - 根據另一列中的單詞添加單詞
- 11. regx找到python 3.x中超過4個單詞的單詞
- 12. 計數單詞的列表中的PYTHON
- 13. Python的單詞計數
- 14. Python:詞典中的詞典?
- 15. 拆分python中的合併單詞
- 16. 更改Python Tkinter中單詞的定義?
- 17. Python檢查列表中的單詞
- 18. 如何分解python中的單詞?
- 19. 在Python中匹配的單詞
- 20. 刪除python中的非英語單詞
- 21. 計算Python中列的單詞頻率
- 22. Python中十六進制值的單詞
- 23. python計算大文件中的單詞
- 24. 掃描Python詞典中的兩個單詞短語
- 25. 獲取英文詞典中的單詞索引:Python
- 26. 基於前後單詞的python單詞分組
- 27. 從Python中的兩個方向上的兩個單詞計算單詞重疊
- 28. 替換多個單詞 - python
- 29. Python:創建單詞分析
- 30. python組計數單詞