Připojit seznam seznamů v pythonu

Příklady kódu

16
0

N

my_list = ['a','b']  
my_list.append('c') 
print(my_list)      # ['a','b','c']

other_list = [1,2] 
my_list.append(other_list) 
print(my_list)      # ['a','b','c',[1,2]]

my_list.extend(other_list) 
print(my_list)      # ['a','b','c',[1,2],1,2]
9
0

N

# Basic syntax:
your_list.append('element_to_append')

# Example usage:
your_list = ['a', 'b']
your_list.append('c')
print(your_list)
--> ['a', 'b', 'c']

# Note, .append() changes the list directly and doesn’t require an 
#	assignment operation. In fact, the following would produce an error:
your_list = your_list.append('c')
9
0

N

list1 = ["hello"]
list1 = list1 + ["world"]
4
0

N

list_of_Lists = [[1,2,3],['hello','world'],[True,False,None]]
list_of_Lists.append([1,'hello',True])
ouput = [[1, 2, 3], ['hello', 'world'], [True, False, None], [1, 'hello', True]]
0
0

N

list.append(item)

V jiných jazycích

Tato stránka je v jiných jazycích

Русский
..................................................................................................................
English
..................................................................................................................
Italiano
..................................................................................................................
Polski
..................................................................................................................
Română
..................................................................................................................
한국어
..................................................................................................................
हिन्दी
..................................................................................................................
Français
..................................................................................................................
Türk
..................................................................................................................
Português
..................................................................................................................
ไทย
..................................................................................................................
中文
..................................................................................................................
Español
..................................................................................................................
Slovenský
..................................................................................................................
Балгарскі
..................................................................................................................
Íslensk
..................................................................................................................