Reputation: 7737
I've got a function:
def user_login(m):
m = "user_login function called"
return m
Calling it with:
user_login(message)
It should change a string, m, and return the result. I know that the function gets called because it throws up an error [user_login() takes exactly 1 argument (0 given)] if I don't put an argument in it. But it doesn't return a string. How can I find out what's wrong?
Upvotes: 0
Views: 1839
Reputation: 142136
You can't "change the string" - instead, what you should be doing, is assigning the result of the function to your string in the calling scope:
m = user_login('some message')
print m
Upvotes: 7