I\'m new to Python. I need to query items from a dict and save the result to a text file. Here\'s what I have:
import json
import exec.fullog as e
input = e
We can simply pass the output of python inbuilt print function to a file after opening the file with the append option by using just two lines of code:
with open('filename.txt', 'a') as file:
print('\nThis printed data will store in a file', file=file)
Hope this may resolve the issue...
Note: this code works with python3 however, python2 is not being supported currently.