开发者

Defining variables to pass to Django models

The following works for me --

email_list = EmailList.objects.get(domain=(开发者_如何学编程cd['email'].split('@')[1]))

But defining the 'domain' variable before does not --

domain = cd['email'].split('@')[1]
email_list = EmailList.objects.get(domain=domain)

When I do the latter, it raises an "EmailList matching query does not exist". What accounts for this difference??


There is nothing that accounts for this difference; Python variables do not change type when bound to a name.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜