吴恩达作业5.2报错解决: emojize() got an unexpected keyword argument ‘use_aliases’
简单记录一下吴恩达作业5.2中,Emoji表情生成器在pycharm上可能出现的报错:TypeError: emojize() got an unexpected keyword argument 'use_aliases'
- 初步判断为emoji包的版本问题
解决方法:
- 在
emo_utils.py中,找到:
def label_to_emoji(label):
"""
Converts a label (int or string) into the corresponding emoji code (string) ready to be printed
"""
return emoji.emojize(emoji_dictionary[str(label)], use_aliases=True)
- 删去返回的
use_aliases=True,也就是:
def label_to_emoji(label):
"""
Converts a label (int or string) into the corresponding emoji code (string) ready to be printed
"""
return emoji.emojize(emoji_dictionary[str(label)])
- 再次运行,问题解决

- 本人为大二编程小白,请大佬们批评指正
文章讲述了在吴恩达机器学习课程作业5.2中,使用Python的emoji库时遇到TypeError,原因在于包的use_aliases参数。通过删除该参数解决了在PyCharm中emojize函数的意外关键字错误。作者是编程新手,寻求大佬们的指导。



2165

被折叠的 条评论
为什么被折叠?



