请使用以下修正后的代码:

for i in range(1, 10):
    for j in range(1, 10):
        result = i * j
        print('{} × {} = {}'.format(i, j, result))

这次使用了format方法来格式化字符串,确保在填充占位符时提供了足够的参数。运行修正后的代码将输出正确的九九乘法表结果。再次对之前给出的错误回答表示歉意。

Python 九九乘法表:解决 'not enough arguments for format string' 错误

原文地址: https://www.cveoy.top/t/topic/kCR 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录