在使用unicode_literals时,使用pygame.Color名称的正确方法是什么
Python 2.7.3 (v2.7.3:70274d53c1dd, Apr 9 2012, 20:52:43)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import pygame
>>> pygame.ver
'1.9.2pre'
>>> pygame.Color('red')
(255, 0, 0, 255)
>>> from __future__ import unicode_literals
>>> pygame.Color('red')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: invalid argument发布于 2012-07-01 06:27:45
>>> type('red')
str
>>> from __future__ import unicode_literals
>>> type('red')
unicode
>>> type(str('red'))
str
>>> import pygame
>>> pygame.ver
'1.9.1release'
>>> pygame.Color(str('red'))
(255, 0, 0, 255)https://stackoverflow.com/questions/11278068
复制相似问题