Avatar ·

Encoding problem when writing to file: UnicodeEncodeError: 'charmap' codec can't encode character '\\u039a'

📁 Advanced Python Topics

Need to parse vk with given parameters and write the result to a file in Python 3.5.

search_result = api.users.search(sort=sort_index, sex=sex_index, age_to=age_index, offset=offset_index, count=count_index, country=country)result = open('result.txt','a')while index != (count_index - offset_index):    result.write(str(search_result[index + 1]))    result.write('')    index += 1result.close()

Getting an error:

Traceback (most recent call last):  File ""E:***\\vkscri