writing only dictionary values into a text file
dictionary, file-io, python
Solution
Just loop over the values then:
with open('log.txt','w') as log:
for value in log_disk.values():
log.write('{}\n'.format(value))
Problem
I just want to write dictionary values into text file line wise line.I can write whole dictionary in to the file using: ``` log_disk={} log=open('log.txt','w') log.write(str(log_disk)) log.close() ``` Any help will be appreciated.In addition I want to avoid those keys which have value 'Empty' while writing into the file.