IT入门 > 教程 > python >
  • Python3 os.walk() 方法 日期:2022-09-11 点击:2756 python

    概述 os.walk() 方法可以创建一个生成器,用以生成所要查找的目录及其子目录下的所有文件。 os.walk() 方法用于通过在目录树中游走输出在目录中的文件名,向上或者向下。 os.walk() 方法...

  • Python3 os.write() 方法 日期:2022-09-11 点击:8446 python

    概述 os.write() 方法用于写入字符串到文件描述符 fd 中. 返回实际写入的字符串长度。 在Unix中有效。 语法 write() 方法语法格式如下: os.write(fd, str) 参数 fd -- 文件描述符。 str -- 写入的字...

  • Python os.write() 方法 日期:2022-09-11 点击:1354 python

    概述 os.write() 方法用于写入字符串到文件描述符 fd 中. 返回实际写入的字符串长度。 在Unix中有效。 语法 write() 方法语法格式如下: os.write(fd, str) 参数 fd -- 文件描述符。 str -- 写入的字...

  • Python3 os.path() 模块 日期:2022-09-11 点击:2770 python

    os.path 模块主要用于获取文件的属性。 以下是 os.path 模块的几种常用方法: 方法 说明 os.path.abspath(path) 返回绝对路径 os.path.basename(path) 返回文件名 os.path.commonprefix(list) 返回list(多个路径...

  • Python3 os.pardir 方法 日期:2022-09-11 点击:9417 python

    概述 os.pardir() 获取当前目录的父目录(上一级目录),以字符串形式显示目录名。 注意: Windows 和 POSIX 返回 .. 。 语法 pardir() 方法语法格式如下: os.pardir 参数 无。 返回值 返回当前目...

  • Python3 time clock()方法 日期:2022-09-11 点击:1047 python

    描述 Python 3.8 已移除 clock() 方法 可以使用 time.perf_counter() 或 time.process_time() 方法替代。 Python time clock() 函数以浮点数计算的秒数返回当前的CPU时间。用来衡量不同程序的耗时,比time....

  • Python3 time mktime()方法 日期:2022-09-11 点击:6257 python

    描述 Python time mktime() 函数执行与gmtime(), localtime()相反的操作,它接收struct_time对象作为参数,返回用秒数来表示时间的浮点数。 如果输入的值不是一个合法的时间,将触发 OverflowError...

  • Python3 time tzset()方法 日期:2022-09-11 点击:8096 python

    描述 Python time tzset() 根据环境变量TZ重新初始化时间相关设置。 标准TZ环境变量格式: std offset [dst [offset [,start[/time], end[/time]]]] 参数 std 和 dst: 三个或者多个时间的缩写字母。传递给...

  • Python help() 函数 日期:2022-09-11 点击:10368 python

    描述 help() 函数用于查看函数或模块用途的详细说明。 语法 help 语法: help([object]) 参数说明: object -- 对象; 返回值 返回对象帮助信息。 实例 以下实例展示了 help 的使用方法: help...

  • Python setattr() 函数 日期:2022-09-11 点击:6341 python

    描述 setattr() 函数对应函数 getattr() ,用于设置属性值,该属性不一定是存在的。 语法 setattr() 语法: setattr(object, name, value) 参数 object -- 对象。 name -- 字符串,对象属性。 value -- 属性值...