您当前的位置: 首页 >  Python

彭世瑜

暂无认证

  • 1浏览

    0关注

    2791博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

Python:标准库atexit退出处理器

彭世瑜 发布时间:2021-03-19 22:23:50 ,浏览量:1

# -*- coding: utf-8 -*-
import atexit


def close():
    print('close')

# 注册方式一
atexit.register(close)

# 注册方式二
@atexit.register
def close_file():
    print('close_file')

输出顺序

close_file
close

参考 atexit — 退出处理器

关注
打赏
1665367115
查看更多评论
立即登录/注册

微信扫码登录

0.0554s