📜  可以将函数输出另存为变量 python 代码示例

📅  最后修改于: 2022-03-11 14:46:17.343000             🧑  作者: Mango

代码示例1
#You have to return something in a function to have it in a variable.

def ex_one():
  print('Hi!')
#This won't work.

def ex_two():
  msg = 'Hi!'
  return msg

#This will work.
var = ex_two