【发布时间】:2020-11-09 01:41:12
【问题描述】:
我有一个名为引号的列表,其中包含很多 JoJo 引号,当我尝试执行时出现该错误。当我将所有的 ' 更改为 "。
quotes = ['Perhaps… Perhaps the time he foretold has come. If this is my destiny, I accept it. - Zeppeli', 'You truly are the lowest scum in history. You can’t pay back what you owe with money. - Jotaro Kujo', 'Impossible? We did a lot of impossible things on this journey. I’m tired of hearing that things are impossible or useless. Those words mean nothing to us. - Jotaro Kujo', 'Shoot me if you want to! But you better be prepared to face the consequences. The moment you try to pull that trigger, I’ll snap your fingers in half like matchsticks! - Joseph Joestar', 'would you be able to pull of a command that randomly generates a jojo quote when you use it - kirbs', 'What? The loser is evil? Well, in that case… you’re the evil one after all! The one who will be the judge is my Stand! - Jotaro Kujo', 'You’re god damn right! Everything worked out according to the plan… From the very beginning! (I just got lucky, but thinking I outsmarted him will drive Kars nuts). - Joseph Joestar', 'You’ve got to say something more like this before you get revenge. My name is Jean-Pierre Polnareff. For my sister’s honor, and so that my friend Avdol can rest in peace... Im going to hurl you into the depths of despair! - Jean-Pierre Polnareff', 'The ultimate being embodies the powers of each and every living thing, all lives gather as one. And… How beautiful it shines! Truly the most wonderful thing I have ever beheld… I have finally, finally tamed the sun! - Kars', 'I shall give you a chance. Go down two steps and I’ll let you join my side again. But if you rather die, then climb those stairs. - Dio Brando' 'KONO DIO DA! - Dio Brando', 'I, Giorno Giovanna, have a dream. - Polpo', 'What did you say? Depending on your answer, I may have to kick your ass! - Joseph Joestar']
【问题讨论】:
-
这是 python 3.x 吗?您的编辑器是否保存在 utf-8 中?您应该能够将其修剪为演示问题的几行程序。很可能您使用的是 Windows 代码页编码,而违规字符是
"…"。它对我们有用,因为您粘贴到 SO 中的是 utf-8。您可以将该字符粘贴到编辑器中并保存。然后print(open('mytestfile', 'rb').read())。如果那是单个字符,则您正在使用代码页。如果是b'\xe2\x80\xa6',那么你有 utf-8。 -
你用的是哪个版本的python?
-
我使用的是 Python 3.8 或 3.7,我忘记了哪个,我使用的是 sublime text。我还删除了所有“...”的字符,因为是的,它们是一个字符,并将它们更改为 2 个点,但没有任何变化。还是一样的错误
标签: python url-rewriting discord discord.py discord.py-rewrite