本文總結 python 中使用 os 模塊發送 shell 命令的不完全總結。
Updated: 2022 / 7 / 28
os.getcwd()獲取文件所在路徑。os.path.exists(path: StrOrBytesPath)用於判斷是否存在指定文件或者文件夾,並返回布爾值:。參考此處 1’ 2’ 3
os.mknod(path, mode, device, dir_fd)用於直接創建一個文件,一般會在此之前判斷文件是否存在。os.mkdir(path)比如,path = E:/poly/ly, 則 os.mkdir("E:/poly/ly") 時第一個目錄 poly 必須存在,第二個目錄 ly 不存在的話則會創建 ly。os.makedirs(path)用於創建遞歸目錄。只要目錄路徑下有不存在的目錄,就會創建該目錄,然後遞歸的創建文件目錄。比如,os.makedirs("E:/poly/ly"),如果第一個目錄 poly 不存在,則創建第一個目錄 poly 以及第二個目錄 ly。python–自動創建文件和創建目錄的方法︎
python創建文件和文件夾︎
python 路徑不存在則創建︎
The parameter of ABS function in Python is the return value of complex number
This abs The function returns
Visual analysis and drawing of scatter chart and edge histogram with trend line in Python
Catalog One 、 Draw a scatter