写入文件时的编码问题:UnicodeEncodeError: 'charmap' codec can't encode character '\u039a'
📁 python
需要根据指定参数配对vk并将结果写入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', 'w') index = 0 while index != (count_index - offset_index): result.write(str(search_result[index + 1])) result.write('\n') index += 1 result.close()我收到一个错误:
Traceback (most recent call last): File "E: *** \\vkScript.py", Line 19, in <