“Daftar Concatenate” Kode Jawaban

Daftar string gabungan

#python 3.x
words_list = ['Joey', 'doesnot', 'share', 'food']
print(" ".join(words_list))
Roberto Espinosa

Daftar Concatenate

sample_list1 = [0, 1, 2, 3, 4] 
sample_list2 = [5, 6, 7, 8] 
 
result = sample_list1 + sample_list2 
 
print ("Concatenated list: " + str(result))
Itchy Impala

Daftar daftar Python Concatenate

x = [["a","b"], ["c"]]

result = sum(x, [])
Puzzled Peacock

Daftar gabungan

>>> t1 = ['a', 'b', 'c']
>>> t2 = ['d', 'e']
>>> t1.extend(t2)
>>> print(t1)
['a', 'b', 'c', 'd', 'e']
Odd Ox

Python - cara menggabungkan daftar string

'separator'.join([ 'List','of',' string' ])
thecodeteacher

Daftar gabungan

>>> a = [1, 2, 3]
>>> b = [4, 5, 6]
>>> c = a + b
>>> print(c)
[1, 2, 3, 4, 5, 6]
Odd Ox

Jawaban yang mirip dengan “Daftar Concatenate”

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya