lig 发表于 2017-5-7 10:37:11

Python 字典与字符串结合输出的例子

  在字典中使用字符串格式符的方法,用字典参数来简化print语句:

dict1={'howmany':1,'where':'wuhan'};
print "%(where)s has %(howmany)s bridge" % dict1
页: [1]
查看完整版本: Python 字典与字符串结合输出的例子