找回密码
 立即注册

扫一扫,访问微社区

QQ登录

只需一步,快速开始

查看: 1556|回复: 2

[求助] 小白求助

1

主题

2

帖子

2

积分

贫民

积分
2
FrankXu 发表于 2018-12-1 14:42:22 | 显示全部楼层 |阅读模式
formatter = "{} {} {} {}"

print(formatter.format(1, 2, 3, 4))
print(formatter.format("one", "two", "three", "four"))
print(formatter.format(True, False, False, True))
print(formatter.format(formatter, formatter, formatter, formatter))
print(formatter.format(
    "Try your" # IndexError: tuple index out of range
    "Own text here"
    "Maybe a poem"
    "Or a song about fear"
))


报错:
PS C:\Users\xulin09> python ex8.py
1 2 3 4
one two three four
True False False True
{} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {}
Traceback (most recent call last):
  File "ex8.py", line 8, in <module>
    "Try your" # IndexError: tuple index out of range
IndexError: tuple index out of range


回复

使用道具 举报

1

主题

2

帖子

2

积分

贫民

积分
2
FrankXu  楼主| 发表于 2018-12-1 14:51:34 | 显示全部楼层
求助啊,谢谢
回复 支持 反对

使用道具 举报

1

主题

2

帖子

2

积分

贫民

积分
2
zuoyoo 发表于 2018-12-4 12:30:54 | 显示全部楼层
print(formatter.format(
    "Try your" # IndexError: tuple index out of range
    "Own text here"
    "Maybe a poem"
    "Or a song about fear"
))

缺少分隔符逗号
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

快速回复 返回顶部 返回列表