Py3.3 unicode literal and input()

Andrew Berg bahamutzero8825 at gmail.com
Mon Jun 18 10:28:59 EDT 2012


Perhaps this will clear things up:

Python 3.3.0a4 (v3.3.0a4:7c51388a3aa7, May 31 2012, 20:17:41) [MSC
v.1600 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> ua = u'a'
>>> literal_ua = "u'a'"
>>> ua == literal_ua
False
>>> input_ua = input()
u'a'
>>> input_ua
"u'a'"
>>> input_ua == ua
False
>>> input_ua == literal_ua
True
>>> eval_ua = eval(literal_ua)
>>> eval_ua
'a'
>>> eval(literal_ua) == input_ua
False
>>> eval(literal_ua) == ua
True
>>> u'a' == 'a'
True
>>> u'a' is 'a'
True


-- 
CPython 3.3.0a4 | Windows NT 6.1.7601.17803



More information about the Python-list mailing list