zoukankan      html  css  js  c++  java
  • python学习,day3:函数式编程

    调用函数来实现文件的修改(abc.txt),并增加上时间,调用的是time模块, 需要注意的是,每个函数一定要用‘’‘ ‘’’ 标注下函数说明

    # coding=utf-8
    # Author: RyAn Bi
    import time
    def ogger():
        '''print ending'''
        time_format ='%Y-%m-%d-%X'
        time_current = time.strftime(time_format)   #显示当前时间
        with open('abc.txt','a+') as f:
            f.write('%s end action
    '%time_current)
    
    def test1():
        print('in the test1')
        ogger()
    def test2():
        print('in the test2')
        ogger()
    def test3():
        print('in the test3')
        ogger()
    
    test1()
    test2()
    test3()
    

      

  • 相关阅读:
    AE旋转
    AE2
    AE1
    面试
    TS 基础数据类型
    vue-cli结构介绍
    js异步加载的5种方式
    slot 插槽的使用
    使用组件的细节点
    Vue 条件渲染
  • 原文地址:https://www.cnblogs.com/bbgoal/p/10370974.html
Copyright © 2011-2022 走看看