如何修复python3中的“sh:1:title:not found”错误?

问题描述

我想为 discord bot 制作一个 twitch 令牌生成器,但是当我运行它时,出现错误

sh: 1: title: not found

我认为出错的代码部分是

success = 0
fail = 0
created = 0

def count():
    while True:
        os.system(f'title S = {success}/ F = {fail} / C = {created}')
        time.sleep(1)

完整源代码here

有人有什么想法吗?任何帮助将不胜感激

解决方法

os.system(f'title S = {success}/ F = {fail} / C = {created}')

您为什么要尝试执行一个您可能应该打印出来的字符串(这就是 os.system() 所做的)?类似的东西:

    print(f'title S = {success}/ F = {fail} / C = {created}')

你的外壳不太可能对此做出很好的反应。