运行这个小程序后:
#!/usr/bin/env python2.7
# -*-coding:utf-8 -*
a = 1
b = 2
c = 3
title = u"""a=""" + a + u""", b=""" + str(b) + \
u""", c=""" + str(c)
print(title)
Run Code Online (Sandbox Code Playgroud)
我收到以下错误:
u""", c=""" + str(c)
TypeError: coercing to Unicode: need string or buffer, int found
Run Code Online (Sandbox Code Playgroud)
但以下运行就好了!
#!/usr/bin/env python2.7
# -*-coding:utf-8 -*
a = 1
b = 2
c = 3
title = u""", b=""" + str(b) + \
u""", c=""" + str(c)
print(title)
Run Code Online (Sandbox Code Playgroud)
有人可以解释一下发生了什么事吗?
| 归档时间: |
|
| 查看次数: |
83402 次 |
| 最近记录: |