Log in or register to post comments To obtain a list of all the keys in a dictionary, we have to use function keys(). Check below example: my_dict={'k1':10,'k2':5,'k3':20,'k4':25} keys_list = [] for key in my_dict.keys(): keys_list.append(key) print(keys_list) Output: ['k1', 'k2', 'k3', 'k4'] Tags Python Data Structure Interview Questions Python Interview Questions