I'm trying to run this code:
import glob
import io
read_files = filter(lambda f: f!='final.txt' and f!='result.txt', glob.glob('*.txt'))
with io.open("REGEXES.rx.txt", "w", encoding='UTF-32') as outfile:
for f in read_files:
with open(f, "r") as infile:
outfile.write(infile.read())
outfile.write('|')
To combine some text files and I get this error:
Traceback (most recent call last):
File "/Users/kosay.jabre/Desktop/Password Assessor/RegexesNEW/CombineFilesCopy.py", line 10, in <module>
outfile.write(infile.read())
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/encodings/ascii.py", line 26, in decode
return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xa3 in position 2189: ordinal not in range(128)
I've tried UTF-8, UTF-16, UTF-32 and latin-1 encodings. Any ideas?