运行 用 Python 修复 Mojibake 的简单脚本,ftfy 给出“*** Remote Interpreter Reinitialized ***”

Running simple script meant to fix Mojibake with Python and ftfy gives "*** Remote Interpreter Reinitialized ***"

当我 运行 除了 "*** Remote Interpreter Reinitialized ***" 什么都没有发生。

# https://junschoi.github.io/posts/ftfy_guide/
import ftfy

def main():  # Added by pyscripter.
    pass

ftfy.fix_text('This text should be in “quotesâ€\x9d.')  # Copied from the web page.

if __name__ == '__main__':  # Added by pyscripter
    main()

首先推荐阅读PythonPEPs。它将帮助您了解 Python 语言语法和最佳实践!另外,尝试改善 post 你的问题!

所以,稍微编辑一下您的代码,我建议这样做:

import ftfy

def main():
    print_quotes = ftfy.fix_text('This text should be in “quotesâ€\x9d.')
    print(print_quotes)

if __name__ == '__main__':
    main()

我只是执行上面编辑的代码,并得到 'This text should be in "quotes".' 作为输出。所以,也许你可以从这里继续。