Variable and object in python file

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

txt = bad_bands_doc.write(‘bad_bands’)

Blockquote

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.