Python, remove brackets from using values from a dict
Solution 1:
You can use liste.extend()
instead. The function append
adds the value that you pass in as a single element to a list, while extend
will take an iterable object and put each item in the list as an item. Like this: liste.extend(pair + [5,6])
Solution 2:
Just another approach maybe? it might do , depends on your task if you could elaborate please I'll gladly help
mappe = {10 : [10, 1]}
#pair = list(mappe.values())
pair=[]
for element in mappe:
for x in mappe[element]:
pair.append(x)
liste = pair.copy()
liste+=[5, 6]
print(liste)