os 模块

常用的命令

os.path.exists("") 判断文件是否存在

os.path.getsize("") 判断文件是否为空

os.getcwd()

os.mkdir()

os.rmdir()

os.chdir()

os.system("") 相当于在cmd中输入命令, 在idle中只是执行命令,并不会在idle中显示结果

 但是在cmd中就会显示结果:

os.popen("") 命令在idle中,可以将结果赋给变量

但是如果打开calc,将打印为空

os.popen(""), 在cmd中,赋给变量后也会打开calculator, 而且也是打印为空

原文地址:https://www.cnblogs.com/zijidefengge/p/13407346.html