- 不带括号
- 带括号
简单来说,函数后不加括号表示引用,带括号表示调用。 不带括号
def hi():
print("hello")
print(type(hi)) # 输出
print(hi) # 输出
带括号
def hi():
print("hello")
hi() # 输出hello
print(hi()) # 输出两行,第一行输出hello,第二行输出None
print(type(hi())) # 输出两行,第一行输出hello,第二行输出
暑期编程PK赛
得CSDN机械键盘等精美礼品!


