Hello. I do not understand what is the error?
for element in NodeName: ListSite.write(''.join(element2[i].getAttribute('org') + '\t' + element.getElementsByTagName('ip')[0].childNodes[0] + '\t' + element.getElementsByTagName('domain')[0].childNodes[0] + '\t' + element.getElementsByTagName('url')[0].childNodes[0]'\t'+ '\n').encode('cp1251')); i += 1;
The compiler swears like this:
TypeError: coercing to Unicode: need string or buffer, instance found
I tried to translate everything into str()
, but the error remains, tried to open the file with the parameter bufering=-1
, also indicated the encoding for opening the file in 'utf-8'. Everything that I found in Google, I tried it. But, something I can not.
.encode('cp1251')
line:.encode('cp1251')
==>.encode('utf-8')
??? - Nitive