Python, what does an underscore before parenthesis do

后端 未结 3 808
鱼传尺愫
鱼传尺愫 2020-12-08 04:12

Looking through some of the Django code at authentication forms I noticed the following syntax

label=_(\"Username\")

Normally I would have

3条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-08 05:01

    It calls the function _ with the argument "Username", just like f("Username") would call the function f. Probably _ is a function for internationalising strings.

提交回复
热议问题