代码问题找不到啊,求解决

print('站点列表 {0}, {1}, 和 {other}。'.format('Google', 'Runoob', other='Taobao'))

img

format前是逗号吧

print里面的参数format和前面是用逗号隔开的,你用的点符号

代码没有问题。

#!/usr/bin/python
# -*- coding: UTF-8 -*-
"""
@author: YangPC
@QQ:327844761
@微信公众号:ewbang
"""

print('站点列表 {0}, {1}, 和 {other}。'.format('Google', 'Runoob', other='Taobao'))

img

可以用f来组合这几个变量,重新打印一下

报错信息不完整,报错的地方有可能不是这的