I am trying to fetch the free disk space details of each drive using Python Scripts and storing the values in a variable 'p'.
p=(disk_usage('C:/'))
f=open('C:\\Python27\\solr.log','a')
f.write("Solr "+p)
I would like to place the results from variable 'p' into a log file. If I print the variable 'p', I am able to get the results successfully. But when I try to open a log file and write into it, it is throwing the below error.
"Traceback (most recent call last):
File "C:\Python27\sample.py", line 51, in <module>
f.write("Result: "+p)
TypeError: must be str, not UsageTuple"
Could anyone please help me on this.