我正在编写这个程序来打印出特定文件夹中所有 mp3 文件的名称,它遇到此错误消息

问题描述

from pathlib import Path

song_folder = Path(r"C:\Users\Tito\Music\Songs\1")

for song in song_folder.glob("*.mp3"):
    print (song.name)

  File "c:\Users\Tito\Documents\VS code\music_sort4.py",line 10,in <module>
    print (file)
  File "C:\Users\Tito\AppData\Local\Programs\Python\python39\lib\encodings\cp1252.py",line 19,in encode
    return codecs.charmap_encode(input,self.errors,encoding_table)[0]
UnicodeEncodeError: 'charmap' codec can't encode characters in position 132-133: character maps to <undefined>

代码打印出mp3文件,遇到这个字符⭐️就报错。什么意思?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)