【问题标题】:List on python: where has the `u` come from? [duplicate]python上的列表:`u`从哪里来? [复制]
【发布时间】:2014-06-13 00:14:15
【问题描述】:

快速提问:

disc_list=[] #creating an empty list to put the discs into
    rad = 70
for i in range(5):
    disc_list.append(cmds.polyCylinder( name = 'disc' + str(i), radius = rad, height = 10)[0]) # create discs
    cmds.move(0, 10*i, 0, ('disc' + str(i)))
    rad = rad*0.7 

    print disc_list

任何人都知道为什么当我打印 disc_list 时,它会返回:

[u'disc0', u'disc1', u'disc2', u'disc3', u'disc4']

u 来自哪里?

【问题讨论】:

  • 当我第一次看到这个时,我有同样的问题。它只是表示字符串是 unicode,如下 sshashank124 状态

标签: python list


【解决方案1】:

u 只是表示它是一个unicode 字符串。你不应该担心它。打印出来还是一样。

for i in disc_list:
    print i

[OUTPUT]
disc0
disc1
disc2
disc3
disc4

Suggested link

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-07-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-02-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多