Python variables as keys to dict January 5, 2023 by Tarik for i in ('apple', 'banana', 'carrot'): fruitdict[i] = locals()[i]