what _ means in expression: reprColor = [_("White"), _("Black")] and why it fails
There is a file const.py with lines like this:
reprColor = [ _("开发者_开发技巧White"), _("Black")]
I got an error on this line:
NameError: name '_' is not defined<br>
What is the problem?
Environment: Python 2.7 / Windows XPI have read that underscore is used as convention for private variables.
A single underscore is used as convention for one of the translation functions in gettext
. Either bind it yourself, or call one of the install()
functions or methods.
A _() call usually means GNU gettext is in use. It's for internationalization of strings.
精彩评论