首页 > 解决方案 > 奇怪的#HASHTAG 编码

问题描述

我遇到了奇怪的标签问题。它在 Instagram 帖子中使用,使其无法检测为标签,但看起来像一个标签。 https://www.instagram.com/p/6JomIetvLK/

尝试将该主题标签复制到谷歌。没有结果。我尝试复制到 python idle 和这个网站,但它会自动转换回正常的主题标签。

我正在尝试在 Instagram 上为我在 python 上的学校项目抓取字幕,这给我带来了问题。

with codecs.open(who+".txt", 'w') as outfile: #adding encoding='utf-8' doesn't help
dump = json.dump(oldData, outfile) #ensure_ascii doesn't help too

UnicodeEncodeError: 'charmap' codec can't encode characters in position 26-27: character maps to and yes.. 26-27 左右是那个奇怪的标签

有任何想法吗?我如何忽略/跳过 json.dump 中的字符?

标签: python-3.xencodinghashtag

解决方案


推荐阅读