I have a list of list (var_list) that I want to "expand" into a flat list (list1), see bellow:
environment = {
"KEY1": "VALUE1",
"KEY2": "VALUE2",
}
var_list = [
["var", f"{key}={value}"] for key, value in environment.items()
]
list1 = ["foo", "bar"]
result = list1.extend(var_list)
# PS. Must be a list, not a `' '.join`
print(f"{result=}") # None.
print(result == ["foo", "bar", "var", "KEY1=KEY1", "var", "KEY2=KEY2"]) # returns False. Should be True or equal
How can I do this in python, without using ' '.join
?