【发布时间】:2013-10-17 00:08:07
【问题描述】:
当尝试将{r[Name]} 重新格式化为大写时(最初是标题:James)
原码
string = 'text {r[Name]} data'.format(r=row)
尝试
string = 'text {r[Name].uppercase()} data'.format(r=row)
我得到了回溯:AttributeError: 'str' object has no attribute 'uppercase'
有什么想法吗?非常感谢 SMALLY
【问题讨论】:
标签: python python-2.7 formatting string-formatting uppercase