Pythonã®ã¤ã³ã¿ã©ã¯ãã£ãã·ã§ã«ã§ããªã¹ãå ã®æ¥æ¬èªããã®ã¾ã¾è¡¨ç¤ºãã
Pythonã®ã¤ã³ã¿ã©ã¯ãã£ãã·ã§ã«ã¯ã¨ã¦ã便å©ãªãã§ããããªã¹ããã¿ãã«ãªã©ã®ã·ã¼ã±ã³ã¹ã®è¦ç´ ãæ¥æ¬èªã®å ´åããã®ã¾ã¾è¡¨ç¤ºã§ãã¾ããã
>>> lst = [u'ã', u'ã', u'ã', u'ã', u'ã'] >>> lst [u'\u3042', u'\u3044', u'\u3046', u'\u3048', u'\u304a']
ãããæ¥æ¬èªã§è¡¨ç¤ºããã«ã¯ãé常foræãç¨ãã¦åè¦ç´ ãprintãã¾ãã
>>> for i in lst: ... print i, ... ã ã ã ã ã
ããã§ã次ã®ãããªæ¸ãæ¹ãããã¨ãforæã使ããªãã¦ããªã¹ãå
ã®æ¥æ¬èªã表示ã§ãã¾ãã
>>> print str(lst).decode("unicode-escape") [u'ã', u'ã', u'ã', u'ã', u'ã']
str()ãrepr()ã«ãã¦ãåä½ãã¾ãã
ãã ããæ¥æ¬èªã¯ã¦ãã³ã¼ãæååã§ãªãã¨è¡¨ç¤ºã§ãã¾ããã
>>> list = ["ã", "ã", "ã", "ã", "ã"] >>> list ['\xe3\x81\x82', '\xe3\x81\x84', '\xe3\x81\x86', '\xe3\x81\x88', '\xe3\x81\x8a'] >>> print str(list).decode("unicode-escape") ['あ', 'い', 'う', 'え', 'お']
ããã§åè¦ç´ ãã¦ãã³ã¼ãæååã«å¤æãããæéã ããªããä»ã«æ¹æ³ã¯ãªãã®ããªã