2011-06-10 48 views

回答

0

电子邮件()

Returns the email address of the user. If you use OpenID, you should not rely on this email address to be correct. Applications should use nickname for displayable names. 

没有内置的方法来做到这一点。但是你可以做这样的事情

from google.appengine.api import users 
user =user=users.get_current_user() 

email = user.email() 
username = str(email).split('@')[0] 
+0

记住,电子邮件地址的用户部分在技术上可以包含一个“@”符号(虽然我从来没有见过一个在野外)。您应该使用rsplit来查找_last_ @符号左侧的所有内容。 – 2011-06-11 07:56:47

1

从谷歌应用服务引擎的代码:

昵称是人类可读的字符串它唯一地标识一个谷歌 用户,类似于用户名。这将是一些用户的电子邮件地址,但不是全部。

所以它可能是用户名或电子邮件取决于帐户。