每次我嘗試運行此代碼時都會收到此錯誤:
script_path = os.path.realpath(__file__)
new_abs_path = os.path.join(script_path, 'Users')
if not os.path.exists(new_abs_path):
os.makedirs(new_abs_path)
uj5u.com熱心網友回復:
試試這個:
import os
path = os.path.join(os.path.dirname(__file__), 'Users')
if not os.path.exists(path):
os.makedirs(path)
您忘記獲取 python 腳本的目錄。您無法在檔案中創建檔案夾...
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/383534.html
標籤:Python python-3.9
