python—多个return值
方法一:使用关键字global
def profile():
global name
global age
name = "Danny"
age = 30
profile()
print(name)
# Output: Danny
print(age)
# Output: 30
方法二:使用tuple,list,dict
def profile():
name = Danny
age = 30
return (name,age)//括号不必须
profile_data = profile()
print(profile_data[0])
print(profile_data[1])