小编Xia*_*Wei的帖子

为什么在Python中使用基于字典的字符串格式时没有引号?

我可能有一个愚蠢的问题:

x = {'a':1,'b':2,'c':3}
print "%(a)s" % x   # works fine
print "%('a')s" % x  # failed
Run Code Online (Sandbox Code Playgroud)

有人能告诉我为什么吗?

python python-2.7

3
推荐指数
1
解决办法
148
查看次数

标签 统计

python ×1

python-2.7 ×1