我对python比较陌生。我正在尝试创建一个脚本,该脚本采用整个蜜蜂电影脚本,清理一些字符,将其拆分为一个列表,然后使用python中的Keyboard模块逐个打印每个单词。 (https://pypi.org/project/keyboard/)但是,在前4000个字符左右之后,代码变成乱码。当我打印脚本分成的列表时,这些单词就很好了。但是,如果我尝试在键盘模块中使用.write()函数,它将最终变成乱码。我怎样才能解决这个问题?我的代码在下面。
import keyboard
beemovie = "bee movie script would be here, but I can imagine you probably don't want to see that."
a = beemovie.replace('- ', '')
b = a.replace('!', '')
c = b.replace('?', '')
d = c.replace('.', '')
e = d.replace(',', '')
splitlist = e.split()
keyboard.wait('shift')
for i in splitlist:
keyboard.write(i + '\n')
这是最终情况的图片。 This happens about 1/4th of the way into the movie, and gibberish just starts spouting for the rest of it. 有人可以告诉我我在做什么错吗?