I'm trying to learn python and I've tried really hard but for some reason I can't figure this out.
This is the module, named user_profile, where the function that I want to import comes from:
def build_profile(first, last, **user_info):
profile = {}
profile['first name'] = first
profile['last name'] = last
for key, value in user_info.items():
profile[key] = value
return profile
user_profile = build_profile('john', 'smith',
city = 'new york',
occupation = 'banker',
girlfriend = 'janice')
for key, value in user_profile.items():
print(key.title() + ": " + value.title())
Now I want to import build_profile into another module like so:
from user_profile import build_profile
I just want build_profile to be imported, but for some reason it runs user_profile entirely. What's going on?