看板 Python 關於我們 聯絡資訊
root='./'+a+'.'+b+'/' if not os.path.isdir(root): os.makedirs(root) 目標是打印出來是 a.b 可是他直接錯誤 用str(.)也沒用 有辦法嗎 抱歉 是我在智障 a的變數有時是數字 所以只要str(a)就好... -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 39.9.126.11 (臺灣) ※ 文章網址: https://www.ptt.cc/bbs/Python/M.1575907287.A.83D.html ※ 編輯: s4028600 (39.9.126.11 臺灣), 12/10/2019 00:22:12
wennie0433: 斜線換成// 12/10 01:05
CaptPlanet: 寫路徑建議用os.path.join 12/10 09:26
TitanEric: 字串可以用format格式化 12/10 10:19
james732: 有個pathlib也可以參考看看 12/10 22:26