How can i write keys of a dictionary to a text file line by line, i.e. one key per line? If there is any link pointing to the same, please direct me to that link. I can find loading text file contents into a dictionary, but i am not able to find the vice-versa.
Share
If all you want to print is the keys (i.e. not the values) you can simply iterate over the dict:
or in Python 3, with the new print function: