在列表中组合对象。python
我知道如何将对象与.append和.extend ect组合,但我不知道如何将列表中的单个对象组合成一个对象 例如 我将如何更改此列表: 列表=[“h”、“e”、“l”、“l”、“o”] 在此列表中:在列表中组合对象。python,python,list,object,Python,List,Object,我知道如何将对象与.append和.extend ect组合,但我不知道如何将列表中的单个对象组合成一个对象 例如 我将如何更改此列表: 列表=[“h”、“e”、“l”、“l”、“o”] 在此列表中: List=[“hello”]可以轻松完成 ["".join(list)] 对于其他用途,您可以将“”替换为希望用作delimeter的任何字符。比如说 my_list = ["these", "should", "be", "separated", "by", "commas"] print "
List=[“hello”]可以轻松完成
["".join(list)]
对于其他用途,您可以将“”替换为希望用作delimeter的任何字符。比如说
my_list = ["these", "should", "be", "separated", "by", "commas"]
print ",".join(my_list)
将输出
"these,should,be,separated,by,commas"
这很容易做到
["".join(list)]
对于其他用途,您可以将“”替换为希望用作delimeter的任何字符。比如说
my_list = ["these", "should", "be", "separated", "by", "commas"]
print ",".join(my_list)
将输出
"these,should,be,separated,by,commas"
我想确切的答案是加入(列表)Oops,是的。编辑我想确切的答案是加入(列表)Oops,是的。编辑