Apr-19-2021, 08:17 PM
At least for such intent, I guess I figured out
Thanks
Thanks
import numpy as np from itertools import chain # A dictionnary is created n = 10 m = 1 X = np.random.random( (n,m) ) Y = np.random.random( (n,m) ) Z = np.random.random( (n,m) ) MyDictionnary = {'Abcissa': X, 'Ordinate': Y, 'Altitude': Z} MyDictionnary2 = {'Abcissa2': X, 'Ordinate2': Y, 'Altitude2': Z, 'Theta': (X+Y)} del X, Y, Z # # Dictionnary keys are listed / the dictionnary is explicitly expressed KeyList0 = list(MyDictionnary.keys()) print("Key list (explicitly) : {}".format(KeyList0)) ## function get keys lists def DictionnaryTest(*args): return(list(chain(*args))) # A list of dictionnary names is now created DictionnaryNamesTable = [MyDictionnary, MyDictionnary2] KeyList2 = DictionnaryTest(*DictionnaryNamesTable) print("Key list2 : {}".format(KeyList2)) ## list composed of a single dictionnary DictionnaryNamesTable = [MyDictionnary] KeyList1 = DictionnaryTest(*DictionnaryNamesTable) print("Key list1 : {}".format(KeyList1))