mood = raw_input("Enter your mood: ").lower()
def setMood(mood):
mood = "awesome"
return mood
if mood != "awesome":
setMood(mood)
print "Yor mood is now %s!" % mood
else: print "You were awesome anyway!"
为什么这会返回原始输入,而不是函数中覆盖的输入?以及如何解决这个问题?
UPDATE !!!
解决方案:
mood = raw_input("Enter your mood: ").lower()
def setMood(mood):
mood = "awesome"
return mood
if mood != "awesome":
mood = setMood(mood)
print "Yor mood is now %s!" % mood
else: print "You were awesome anyway!"
答案 0 :(得分:0)
mood
外setMood
是全局的,但其中的select m.* from member m
where not exists (
select 1
from group_member gm
where gm.member_id = m.member_id and group_id = ? )
是本地的。有关更多信息,请参阅官方python文档。