Variable and object in python file

with open(‘bad_bands.txt’,‘w’) as bad_bands_doc:

txt = bad_bands_doc.write(‘bad_bands’)


In the code above, what is virable and what is object?

The line of code provided opens bad_bands.txt with write permissions, and assigns it to the variable of bad_bands_doc.

Review this page on the use of the with statement as it relates to file input/output.