I'm working on Python and have defined a variable called "_headers" as shown below
_headers = ('id',
'recipient_address_1',
'recipient_address_2',
'recipient_address_3',
'recipient_address_4',
'recipient_address_5',
'recipient_address_6',
'recipient_postcode',
)
and in order to write this into an output file, I've written the following statement but it throws me the error "AttributeError: 'str' object has no attribute 'write'"
with open(outfile, 'w') as f:
outfile.write(self._headers)
print done
Please help
f.write(self._headers)
? – Ashwini Chaudhary