Have error by using pypandoc writing to file

142 Views Asked by At

I'm trying to write to file the string that i got after running pypandoc. After writing to file im getting a bounch of UnicodeEncodeError's. My question how can i write to file without any encoding. To write string as is? Thank you.

from tools.general import *
from definitions.url_Parse import *
from data import *
import spacy
import re
import pypandoc
url='https://groupprops.subwiki.org/w/index.php?title=1-automorphism- 
invariant_subgroup&action=edit'
strng = url_Parse(url)
str_ = strng.string
output = pypandoc.convert_text(str_, 'plain', format = 'mediawiki')

file1=open('output.txt','w')
file1.write(output)
file1.close()

My string is: A subgroup H of a group G is termed a 1-AUTOMORPHISM-INVARIANT subgroup if any 1-automorphism of G sends H to itself. In other words, for every 1-automorphism φ of G, φ(H) ⊆ H.

0

There are 0 best solutions below