What does 'u' mean in a list?

前端 未结 4 1763
独厮守ぢ
独厮守ぢ 2020-11-29 11:09

This is the first time I\'ve came across this. Just printed a list and each element seems to have a u in front of it i.e.

[u\'hello\', u         


        
4条回答
  •  温柔的废话
    2020-11-29 11:30

    it's an indication of unicode string. similar to r'' for raw string.

    >>> type(u'abc')
    
    >>> r'ab\c'
    'ab\\c'
    

提交回复
热议问题