机器人
AI 摘要
切换
CatGPT - TianliGPT(1)
本节课主要学习了 Python 中的 sys 模块

Python 中的 sys 模块

sys 中的常用方法

函数名 参数 介绍 举例 返回值
modules Py 启动时加载的模块 sys.modules( ) 列表
path 返回当前 py 的环境路径 sys.path() 列表
exit arg 退出程序 sys.exit(0)
getdefaultencoding 获取系统编码 sys.getdefaultencoding() 字符串
platform 获取当前系统平台 sys.platform() 字符串
version(属性) 获取 python 版本 sys.version 字符串
argv *args 程序外部获取参数 sys.argv 列表

代码