语法代码无效



# 设置背景颜色 arcade.set_background_color(arcade.color.AMAZON(

    # Set the viewport boundaries
    # These numbers set where we have 'scrolled' to.
    self.view_left = 0
    self.view_bottom = 0
    **print(f"Total wall blocks: {len(self.wall_list)}")**
def on_draw(self):
    """
    Render the screen.
    """

当代码完整运行时,无效语法不断出现。我通常很擅长为我的学生解决 Python 代码中的问题,但这让我感到困惑。我们使用 Python 3.4.4

f字符串语法仅在 Python 3.6 中可用。尝试

print("Total wall blocks: {}".format(len(self.wall_list)))

PS 我假设您正在使用print周围的**来强调。如果没有,也请删除它们

最新更新