0基础小小白,求大神解释下^_^~
print(type(u'1'));
输出为:<class 'str'>
但是u' 表示的不是unicode的字符串吗?怎么会是str?
type是得到一个常量或变量的类型的
你的u'1'是个常量,它是一个unicode的字串‘1’
所以type返回的是
<class 'str'>
表示‘1’是个字串类
热门标签:
print(type(u'1'));
输出为:<class 'str'>
但是u' 表示的不是unicode的字符串吗?怎么会是str?
type是得到一个常量或变量的类型的
你的u'1'是个常量,它是一个unicode的字串‘1’
所以type返回的是
<class 'str'>
表示‘1’是个字串类