python 缩进-函数首行不需要缩进

import time

def time(func):
    print(time.ctime())
    return func()

@time  # 从这里可以看出@time 等价于 time(xxx()),但是这种写法你得考虑python代码的执行顺序
def xxx():
    print('Hello world!')

函数首行不需要缩进

 

猜你喜欢

转载自blog.csdn.net/jpmsdn/article/details/83867564